@@ -79,6 +79,15 @@ public void StringEquality()
7979 first . Should ( ) . Be ( second ) ;
8080 }
8181
82+ [ U ]
83+ public void StringInequality ( )
84+ {
85+ Field first = "Name" ;
86+ Field second = "name" ;
87+
88+ first . Should ( ) . NotBe ( second ) ;
89+ }
90+
8291 [ U ]
8392 public void Expression ( )
8493 {
@@ -159,8 +168,7 @@ public void ExpressionWithDictionaryItemVariableExpression()
159168 resolved . Should ( ) . Contain ( key ) ;
160169 }
161170
162- [ U ]
163- public void ExpressionWithDictionaryItemConstantExpression ( )
171+ [ U ] public void ExpressionWithDictionaryItemConstantExpression ( )
164172 {
165173 var resolver = new TestableFieldResolver ( new ConnectionSettings ( ) ) ;
166174 var resolved = resolver . Resolve ( Field < Project > ( p => p . Metadata [ "key1" ] ) ) ;
@@ -171,6 +179,19 @@ public void ExpressionWithDictionaryItemConstantExpression()
171179 resolved . Should ( ) . Contain ( "key2" ) ;
172180 }
173181
182+ [ U ] public void ExpressionWithDictionaryItemConstantExpressionAndVariableSuffix ( )
183+ {
184+ var resolver = new TestableFieldResolver ( new ConnectionSettings ( ) ) ;
185+ var suffix = "x" ;
186+ var resolved = resolver . Resolve ( Field < Project > ( p => p . Metadata [ "key1" ] . Suffix ( suffix ) ) ) ;
187+ resolver . CachedFields . Should ( ) . Be ( 0 ) ;
188+ resolved . Should ( ) . Contain ( "key1" ) . And . EndWith ( ".x" ) ;
189+ suffix = "y" ;
190+ resolved = resolver . Resolve ( Field < Project > ( p => p . Metadata [ "key2" ] . Suffix ( suffix ) ) ) ;
191+ resolver . CachedFields . Should ( ) . Be ( 0 ) ;
192+ resolved . Should ( ) . Contain ( "key2" ) . And . EndWith ( ".y" ) ;
193+ }
194+
174195 [ U ]
175196 public void ExpressionWithDictionarySuffix ( )
176197 {
@@ -217,7 +238,7 @@ public void PropertyInfo()
217238 resolver . Resolve ( ( Field ) typeof ( Project ) . GetProperty ( nameof ( Project . Name ) ) ) ;
218239 resolver . CachedFields . Should ( ) . Be ( 1 ) ;
219240 resolver . Resolve ( ( Field ) typeof ( Project ) . GetProperty ( nameof ( Project . Name ) ) ) ;
220- resolver . CachedFields . Should ( ) . Be ( 1 ) ; ;
241+ resolver . CachedFields . Should ( ) . Be ( 1 ) ;
221242 }
222243
223244 [ U ]
@@ -280,6 +301,14 @@ public void PropertyInfoEquality()
280301 first . Should ( ) . Be ( second ) ;
281302 }
282303
304+ [ U ]
305+ public void PropertyInfoInequality ( )
306+ {
307+ PropertyName first = typeof ( Project ) . GetProperty ( nameof ( Project . Name ) ) ;
308+ PropertyName second = typeof ( Project ) . GetProperty ( nameof ( Project . NumberOfCommits ) ) ;
309+
310+ first . Should ( ) . NotBe ( second ) ;
311+ }
283312 [ U ]
284313 public void StringEquality ( )
285314 {
@@ -381,7 +410,7 @@ public CachePerformance(ITestOutputHelper output)
381410 public class HitTiming
382411 {
383412 public string Name { get ; set ; }
384- public Field Field { get ; set ; }
413+ public Func < Field > Field { get ; set ; }
385414 public double FirstHit { get ; set ; }
386415 public double CachedHit { get ; set ; }
387416
@@ -397,39 +426,39 @@ public void CachedVsNonCached()
397426 {
398427 _resolver = new FieldResolver ( new ConnectionSettings ( ) ) ;
399428
400- AddTiming ( Field < Project > ( p => p . Metadata [ "fixed" ] ) ) ;
429+ AddTiming ( ( ) => Field < Project > ( p => p . Metadata [ "fixed" ] ) ) ;
401430 var x = "dynamic" ;
402- AddTiming ( Field < Project > ( p => p . Metadata [ x ] ) ) ;
403- AddTiming ( Field < Project > ( p => p . Name ) ) ;
404- AddTiming ( Field < Project > ( p => p . Description ) ) ;
405- AddTiming ( Field < Project > ( p => p . NumberOfCommits ) ) ;
406- AddTiming ( Field < Project > ( p => p . LastActivity ) ) ;
407- AddTiming ( Field < Project > ( p => p . LeadDeveloper ) ) ;
408- AddTiming ( Field < Project > ( p => p . Metadata ) ) ;
409- AddTiming ( Field < Project > ( p => p . Tags ) ) ;
410- AddTiming ( Field < Project > ( p => p . CuratedTags ) ) ;
411-
412- AddTiming ( Field < CommitActivity > ( p => p . Id ) ) ;
413- AddTiming ( Field < CommitActivity > ( p => p . Message ) ) ;
414- AddTiming ( Field < CommitActivity > ( p => p . ProjectName ) ) ;
415- AddTiming ( Field < CommitActivity > ( p => p . StringDuration ) ) ;
431+ AddTiming ( ( ) => Field < Project > ( p => p . Metadata [ x ] ) ) ;
432+ AddTiming ( ( ) => Field < Project > ( p => p . Name ) ) ;
433+ AddTiming ( ( ) => Field < Project > ( p => p . Description ) ) ;
434+ AddTiming ( ( ) => Field < Project > ( p => p . NumberOfCommits ) ) ;
435+ AddTiming ( ( ) => Field < Project > ( p => p . LastActivity ) ) ;
436+ AddTiming ( ( ) => Field < Project > ( p => p . LeadDeveloper ) ) ;
437+ AddTiming ( ( ) => Field < Project > ( p => p . Metadata ) ) ;
438+ AddTiming ( ( ) => Field < Project > ( p => p . Tags ) ) ;
439+ AddTiming ( ( ) => Field < Project > ( p => p . CuratedTags ) ) ;
440+
441+ AddTiming ( ( ) => Field < CommitActivity > ( p => p . Id ) ) ;
442+ AddTiming ( ( ) => Field < CommitActivity > ( p => p . Message ) ) ;
443+ AddTiming ( ( ) => Field < CommitActivity > ( p => p . ProjectName ) ) ;
444+ AddTiming ( ( ) => Field < CommitActivity > ( p => p . StringDuration ) ) ;
416445
417446 output . WriteLine ( _timings . Aggregate ( new StringBuilder ( ) . AppendLine ( ) , ( sb , s ) => sb . AppendLine ( s . ToString ( ) ) , sb => sb . ToString ( ) ) ) ;
418447 }
419448
420- private void AddTiming ( Field field )
449+ private void AddTiming ( Func < Field > field )
421450 {
422451 var timing = new HitTiming { Field = field } ;
423452 _timings . Add ( timing ) ;
424453
425454 _stopwatch = Stopwatch . StartNew ( ) ;
426455
427- timing . Name = _resolver . Resolve ( field ) ;
456+ timing . Name = _resolver . Resolve ( field ( ) ) ;
428457 timing . FirstHit = _stopwatch . Elapsed . TotalMilliseconds ;
429458
430459 _stopwatch . Restart ( ) ;
431460
432- _resolver . Resolve ( field ) ;
461+ _resolver . Resolve ( field ( ) ) ;
433462 timing . CachedHit = _stopwatch . Elapsed . TotalMilliseconds ;
434463
435464 _stopwatch . Stop ( ) ;
0 commit comments