@@ -54,10 +54,13 @@ private void AssertIsNotConditionless(IQueryContainer c)
5454 Query = this . QueryInitializer
5555 } ;
5656
57+ protected virtual NotConditionlessWhen NotConditionlessWhen => null ;
5758 protected virtual ConditionlessWhen ConditionlessWhen => null ;
5859
5960 protected QueryContainer ConditionlessQuery = new QueryContainer ( new TermQuery { } ) ;
6061
62+ protected QueryContainer VerbatimQuery = new QueryContainer ( new TermQuery { IsVerbatim = true } ) ;
63+
6164 [ U ]
6265 public void SeenByVisitor ( )
6366 {
@@ -84,6 +87,19 @@ public void ConditionlessWhenExpectedToBe()
8487 ( ( IQueryContainer ) this . QueryInitializer ) . IsConditionless . Should ( ) . BeFalse ( ) ;
8588 }
8689
90+ [ U ]
91+ public void NotConditionlessWhenExpectedToBe ( )
92+ {
93+ if ( NotConditionlessWhen == null ) return ;
94+ foreach ( var when in NotConditionlessWhen )
95+ {
96+ var query = this . QueryFluent ( new QueryContainerDescriptor < Project > ( ) ) ;
97+ when ( query ) ;
98+ query = this . QueryInitializer ;
99+ when ( query ) ;
100+ }
101+ }
102+
87103 private void IsConditionless ( IQueryContainer q , bool be ) => q . IsConditionless . Should ( ) . Be ( be ) ;
88104 }
89105
@@ -114,4 +130,30 @@ private void Assert(IQueryContainer c, Action<TQuery> when)
114130 c . IsConditionless . Should ( ) . BeTrue ( ) ;
115131 }
116132 }
133+
134+ public abstract class NotConditionlessWhen : List < Action < QueryContainer > >
135+ {
136+ }
137+ public class NotConditionlessWhen < TQuery > : NotConditionlessWhen where TQuery : IQuery
138+ {
139+ private readonly Func < IQueryContainer , TQuery > _dispatch ;
140+
141+ public NotConditionlessWhen ( Func < IQueryContainer , TQuery > dispatch )
142+ {
143+ _dispatch = dispatch ;
144+ }
145+
146+ public void Add ( Action < TQuery > when )
147+ {
148+ this . Add ( q => Assert ( q , when ) ) ;
149+ }
150+
151+ private void Assert ( IQueryContainer c , Action < TQuery > when )
152+ {
153+ TQuery q = this . _dispatch ( c ) ;
154+ when ( q ) ;
155+ q . Conditionless . Should ( ) . BeFalse ( ) ;
156+ c . IsConditionless . Should ( ) . BeFalse ( ) ;
157+ }
158+ }
117159}
0 commit comments