1414using Xtensive . Orm . Model ;
1515using Xtensive . Orm . Providers ;
1616using Xtensive . Orm . Tests . Storage . PartialIndexTestModel ;
17+ using NUnit . Framework . Interfaces ;
1718
1819namespace Xtensive . Orm . Tests . Storage . PartialIndexTestModel
1920{
@@ -70,25 +71,97 @@ public class SimpleFilterWithProperty : TestBase
7071 }
7172
7273 [ HierarchyRoot , Index ( nameof ( Target ) , Filter = nameof ( Index ) ) ]
73- public class FilterOnReferenceField : TestBase
74+ public class FilterOnReferenceField1 : TestBase
7475 {
75- public static Expression < Func < FilterOnReferenceField , bool > > Index ( ) =>
76+ public static Expression < Func < FilterOnReferenceField1 , bool > > Index ( ) =>
7677 test => test . Target != null ;
7778
7879 [ Field ]
7980 public TargetEntity Target { get ; set ; }
8081 }
8182
8283 [ HierarchyRoot , Index ( nameof ( Target ) , Filter = nameof ( Index ) ) ]
83- public class FilterOnComplexReferenceField : TestBase
84+ public class FilterOnReferenceField2 : TestBase
8485 {
85- public static Expression < Func < FilterOnComplexReferenceField , bool > > Index ( ) =>
86+ public static Expression < Func < FilterOnReferenceField2 , bool > > Index ( ) =>
87+ test => test . Target == null ;
88+
89+ [ Field ]
90+ public TargetEntity Target { get ; set ; }
91+ }
92+
93+ [ HierarchyRoot , Index ( nameof ( Target ) , Filter = nameof ( Index ) ) ]
94+ public class FilterOnReferenceField3 : TestBase
95+ {
96+ public static Expression < Func < FilterOnReferenceField3 , bool > > Index ( ) =>
97+ test => test . Target == test . Alien ;
98+
99+ [ Field ]
100+ public TargetEntity Target { get ; set ; }
101+
102+ [ Field ]
103+ public TargetEntity Alien { get ; set ; }
104+ }
105+
106+ [ HierarchyRoot , Index ( nameof ( Target ) , Filter = nameof ( Index ) ) ]
107+ public class FilterOnReferenceField4 : TestBase
108+ {
109+ public static Expression < Func < FilterOnReferenceField4 , bool > > Index ( ) =>
110+ test => test . Target != test . Alien ;
111+
112+ [ Field ]
113+ public TargetEntity Target { get ; set ; }
114+
115+ [ Field ]
116+ public TargetEntity Alien { get ; set ; }
117+ }
118+
119+ [ HierarchyRoot , Index ( nameof ( Target ) , Filter = nameof ( Index ) ) ]
120+ public class FilterOnComplexReferenceField1 : TestBase
121+ {
122+ public static Expression < Func < FilterOnComplexReferenceField1 , bool > > Index ( ) =>
86123 test => test . Target != null ;
87124
88125 [ Field ]
89126 public ComplexTargetEntity Target { get ; set ; }
90127 }
91128
129+ [ HierarchyRoot , Index ( nameof ( Target ) , Filter = nameof ( Index ) ) ]
130+ public class FilterOnComplexReferenceField2 : TestBase
131+ {
132+ public static Expression < Func < FilterOnComplexReferenceField2 , bool > > Index ( ) =>
133+ test => test . Target == null ;
134+
135+ [ Field ]
136+ public ComplexTargetEntity Target { get ; set ; }
137+ }
138+
139+ [ HierarchyRoot , Index ( nameof ( Target ) , Filter = nameof ( Index ) ) ]
140+ public class FilterOnComplexReferenceField3 : TestBase
141+ {
142+ public static Expression < Func < FilterOnComplexReferenceField3 , bool > > Index ( ) =>
143+ test => test . Target == test . Alien ;
144+
145+ [ Field ]
146+ public ComplexTargetEntity Target { get ; set ; }
147+
148+ [ Field ]
149+ public ComplexTargetEntity Alien { get ; set ; }
150+ }
151+
152+ [ HierarchyRoot , Index ( nameof ( Target ) , Filter = nameof ( Index ) ) ]
153+ public class FilterOnComplexReferenceField4 : TestBase
154+ {
155+ public static Expression < Func < FilterOnComplexReferenceField4 , bool > > Index ( ) =>
156+ test => test . Target != test . Alien ;
157+
158+ [ Field ]
159+ public ComplexTargetEntity Target { get ; set ; }
160+
161+ [ Field ]
162+ public ComplexTargetEntity Alien { get ; set ; }
163+ }
164+
92165 [ HierarchyRoot , Index ( nameof ( Target ) , Filter = nameof ( Index ) ) ]
93166 public class FilterOnReferenceIdField : TestBase
94167 {
@@ -168,7 +241,7 @@ public class ContainsOperatorSupport : TestBase
168241 public class ConditionalExpressionSuport : TestBase
169242 {
170243 public static Expression < Func < ConditionalExpressionSuport , bool > > Index =>
171- test => test . Id == ( ( test . TestField == null ) ? 100 : 200 ) ? test . TestField . Contains ( "hello" ) : false ;
244+ test => test . Id == 100 ? test . TestField . Contains ( "hello" ) : false ;
172245
173246 [ Field ]
174247 public string TestField { get ; set ; }
@@ -530,10 +603,28 @@ private void AssertBuildFailure(params Type[] entities)
530603 public void SimpleFilterWithPropertyTest ( ) => AssertBuildSuccess ( typeof ( SimpleFilterWithProperty ) ) ;
531604
532605 [ Test ]
533- public void FilterOnReferenceFieldTest ( ) => AssertBuildSuccess ( typeof ( FilterOnReferenceField ) ) ;
606+ public void FilterOnReferenceFieldTest1 ( ) => AssertBuildSuccess ( typeof ( FilterOnReferenceField1 ) ) ;
607+
608+ [ Test ]
609+ public void FilterOnReferenceFieldTest2 ( ) => AssertBuildSuccess ( typeof ( FilterOnReferenceField2 ) ) ;
610+
611+ [ Test ]
612+ public void FilterOnReferenceFieldTest3 ( ) => AssertBuildFailure ( typeof ( FilterOnReferenceField3 ) ) ;
534613
535614 [ Test ]
536- public void FilterOnComplexReferenceFieldTest ( ) => AssertBuildSuccess ( typeof ( FilterOnComplexReferenceField ) ) ;
615+ public void FilterOnReferenceFieldTest4 ( ) => AssertBuildFailure ( typeof ( FilterOnReferenceField4 ) ) ;
616+
617+ [ Test ]
618+ public void FilterOnComplexReferenceFieldTest1 ( ) => AssertBuildSuccess ( typeof ( FilterOnComplexReferenceField1 ) ) ;
619+
620+ [ Test ]
621+ public void FilterOnComplexReferenceFieldTest2 ( ) => AssertBuildSuccess ( typeof ( FilterOnComplexReferenceField2 ) ) ;
622+
623+ [ Test ]
624+ public void FilterOnComplexReferenceFieldTest3 ( ) => AssertBuildFailure ( typeof ( FilterOnComplexReferenceField3 ) ) ;
625+
626+ [ Test ]
627+ public void FilterOnComplexReferenceFieldTest4 ( ) => AssertBuildFailure ( typeof ( FilterOnComplexReferenceField4 ) ) ;
537628
538629 [ Test ]
539630 public void FilterOnReferenceFieldIdTest ( ) => AssertBuildSuccess ( typeof ( FilterOnReferenceIdField ) ) ;
@@ -553,7 +644,7 @@ private void AssertBuildFailure(params Type[] entities)
553644 [ Test ]
554645 public void ContainsOperatorSupportTest ( ) => AssertBuildSuccess ( typeof ( ContainsOperatorSupport ) ) ;
555646
556- [ Test ]
647+ [ Test , RequirePostgreSql ]
557648 public void ConditionalOperationSupportTest ( ) => AssertBuildSuccess ( typeof ( ConditionalExpressionSuport ) ) ;
558649
559650 [ Test ]
@@ -577,12 +668,34 @@ private void AssertBuildFailure(params Type[] entities)
577668 [ Test ]
578669 public void EnumFieldFilterTest ( ) => AssertBuildSuccess ( typeof ( EnumFieldFilter ) ) ;
579670
580- [ Test ]
581- public void ValidateTest ( )
671+ [ Test , RequirePostgreSql ]
672+ public void ValidateTestForPgSql ( )
673+ {
674+ var types = typeof ( TestBase ) . Assembly
675+ . GetTypes ( )
676+ . Where ( type => type . Namespace == typeof ( TestBase ) . Namespace
677+ && type != typeof ( InheritanceClassTable )
678+ && type != typeof ( FilterOnReferenceField3 )
679+ && type != typeof ( FilterOnReferenceField4 )
680+ && type != typeof ( FilterOnComplexReferenceField3 )
681+ && type != typeof ( FilterOnComplexReferenceField4 ) )
682+ . ToList ( ) ;
683+ BuildDomain ( types , DomainUpgradeMode . Recreate ) ;
684+ BuildDomain ( types , DomainUpgradeMode . Validate ) ;
685+ }
686+
687+ [ Test , RequireSqlServer ]
688+ public void ValidateTestForSqlServer ( )
582689 {
583690 var types = typeof ( TestBase ) . Assembly
584691 . GetTypes ( )
585- . Where ( type => type . Namespace == typeof ( TestBase ) . Namespace && type != typeof ( InheritanceClassTable ) )
692+ . Where ( type => type . Namespace == typeof ( TestBase ) . Namespace
693+ && type != typeof ( InheritanceClassTable )
694+ && type != typeof ( ConditionalExpressionSuport )
695+ && type != typeof ( FilterOnReferenceField3 )
696+ && type != typeof ( FilterOnReferenceField4 )
697+ && type != typeof ( FilterOnComplexReferenceField3 )
698+ && type != typeof ( FilterOnComplexReferenceField4 ) )
586699 . ToList ( ) ;
587700 BuildDomain ( types , DomainUpgradeMode . Recreate ) ;
588701 BuildDomain ( types , DomainUpgradeMode . Validate ) ;
0 commit comments