11using System ;
22using System . Collections . Generic ;
33using Elasticsearch . Net ;
4+ using FluentAssertions ;
45using NUnit . Framework ;
56using System . Linq . Expressions ;
67using Newtonsoft . Json ;
@@ -17,7 +18,7 @@ internal class SomeClass
1718 [ JsonConverter ( typeof ( DictionaryKeysAreNotPropertyNamesJsonConverter ) ) ]
1819 public Dictionary < string , SomeOtherClass > StringDict { get ; set ; }
1920 public Dictionary < int , MyCustomClass > IntDict { get ; set ; }
20- public IList < MyCustomClass > ListOfCustomClasses { get ; set ; }
21+ public IList < MyCustomClass > ListOfCustomClasses { get ; set ; }
2122 }
2223 [ ElasticType ( IdProperty = "Guid" ) ]
2324 internal class SomeOtherClass
@@ -80,7 +81,7 @@ public void TestUsesElasticProperty()
8081 var expected = "myCustomClass.MID" ;
8182 Assert . AreEqual ( expected , propertyName ) ;
8283 }
83-
84+
8485 [ Test ]
8586 public void TestUsesOtherElasticProperty ( )
8687 {
@@ -89,7 +90,7 @@ public void TestUsesOtherElasticProperty()
8990 var expected = "custom.MID" ;
9091 Assert . AreEqual ( expected , propertyName ) ;
9192 }
92-
93+
9394 [ Test ]
9495 public void TestUsesOtherElasticTypePropertyIsIgnored ( )
9596 {
@@ -98,7 +99,7 @@ public void TestUsesOtherElasticTypePropertyIsIgnored()
9899 var expected = "myCustomOtherClass.MID" ;
99100 Assert . AreEqual ( expected , propertyName ) ;
100101 }
101-
102+
102103 [ Test ]
103104 public void TestCreatedDate ( )
104105 {
@@ -107,12 +108,12 @@ public void TestCreatedDate()
107108 var expected = "CreateDate" ;
108109 Assert . AreEqual ( expected , propertyName ) ;
109110 }
110-
111+
111112 [ Test ]
112113 public void TestDictionaryConstStringExpression ( )
113114 {
114115 Expression < Func < SomeClass , object > > exp = ( m ) => m . StringDict [ "someValue" ] . CreateDate ;
115- var propertyName = _client . Infer . PropertyPath ( exp ) ;
116+ var propertyName = _client . Infer . PropertyPath ( exp ) ;
116117 var expected = "stringDict.someValue.CreateDate" ;
117118 Assert . AreEqual ( expected , propertyName ) ;
118119 }
@@ -126,40 +127,40 @@ public void TestDictionaryConstIntExpression()
126127 Assert . AreEqual ( expected , propertyName ) ;
127128 }
128129
129- [ Test ]
130- public void TestDictionaryStringExpression ( )
131- {
132- string index = "someValue" ;
133- Expression < Func < SomeClass , object > > exp = ( m ) => m . StringDict [ index ] . CreateDate ;
134- var propertyName = _client . Infer . PropertyPath ( exp ) ;
135- var expected = "stringDict.someValue.CreateDate" ;
136- Assert . AreEqual ( expected , propertyName ) ;
137- }
138-
139- [ Test ]
140- public void TestDictionaryIntExpression ( )
141- {
142- var index = 101 ;
143- Expression < Func < SomeClass , object > > exp = ( m ) => m . IntDict [ index ] . MyProperty ;
144- var propertyName = _client . Infer . PropertyPath ( exp ) ;
145- var expected = "intDict.101.MID" ;
146- Assert . AreEqual ( expected , propertyName ) ;
147- }
148-
149- [ Test ]
150- public void TestDictionaryStringDiffValues ( )
151- {
152- string index = "someValue1" ;
153- Expression < Func < SomeClass , object > > exp = ( m ) => m . StringDict [ index ] . CreateDate ;
154- var propertyName = _client . Infer . PropertyPath ( exp ) ;
155- var expected1 = "stringDict.someValue1.CreateDate" ;
156- Assert . AreEqual ( expected1 , propertyName ) ;
157- index = "someValue2" ;
158- exp = ( m ) => m . StringDict [ index ] . CreateDate ;
159- propertyName = _client . Infer . PropertyPath ( exp ) ;
160- var expected2 = "stringDict.someValue2.CreateDate" ;
161- Assert . AreEqual ( expected2 , propertyName ) ;
162- }
130+ [ Test ]
131+ public void TestDictionaryStringExpression ( )
132+ {
133+ string index = "someValue" ;
134+ Expression < Func < SomeClass , object > > exp = ( m ) => m . StringDict [ index ] . CreateDate ;
135+ var propertyName = _client . Infer . PropertyPath ( exp ) ;
136+ var expected = "stringDict.someValue.CreateDate" ;
137+ Assert . AreEqual ( expected , propertyName ) ;
138+ }
139+
140+ [ Test ]
141+ public void TestDictionaryIntExpression ( )
142+ {
143+ var index = 101 ;
144+ Expression < Func < SomeClass , object > > exp = ( m ) => m . IntDict [ index ] . MyProperty ;
145+ var propertyName = _client . Infer . PropertyPath ( exp ) ;
146+ var expected = "intDict.101.MID" ;
147+ Assert . AreEqual ( expected , propertyName ) ;
148+ }
149+
150+ [ Test ]
151+ public void TestDictionaryStringDiffValues ( )
152+ {
153+ string index = "someValue1" ;
154+ Expression < Func < SomeClass , object > > exp = ( m ) => m . StringDict [ index ] . CreateDate ;
155+ var propertyName = _client . Infer . PropertyPath ( exp ) ;
156+ var expected1 = "stringDict.someValue1.CreateDate" ;
157+ Assert . AreEqual ( expected1 , propertyName ) ;
158+ index = "someValue2" ;
159+ exp = ( m ) => m . StringDict [ index ] . CreateDate ;
160+ propertyName = _client . Infer . PropertyPath ( exp ) ;
161+ var expected2 = "stringDict.someValue2.CreateDate" ;
162+ Assert . AreEqual ( expected2 , propertyName ) ;
163+ }
163164
164165 [ Test ]
165166 public void TestCollectionIndexExpressionDoesNotEndUpInPath ( )
@@ -170,7 +171,7 @@ public void TestCollectionIndexExpressionDoesNotEndUpInPath()
170171 Assert . AreEqual ( expected , propertyName ) ;
171172 }
172173
173- [ Test ]
174+ [ Test ]
174175 public void SearchUsesTheProperResolver ( )
175176 {
176177 var result = this . _client . Search < SomeOtherClass > ( s => s
@@ -182,7 +183,7 @@ public void SearchUsesTheProperResolver()
182183 mp => mp . ConstantScore ( cs => cs . Filter ( filter => filter . Term ( x => x . MyCustomOtherClass . MyProperty , "serverid" ) ) )
183184 )
184185 )
185- && query . Term ( f=> f . CreateDate , "x" )
186+ && query . Term ( f => f . CreateDate , "x" )
186187 )
187188 ) ;
188189 var request = result . ConnectionStatus . Request . Utf8String ( ) ;
@@ -191,7 +192,7 @@ public void SearchUsesTheProperResolver()
191192 StringAssert . Contains ( "CreateDate" , request ) ;
192193 }
193194
194- [ Test ]
195+ [ Test ]
195196 public void SearchDoesntLowercaseStringFieldOverload ( )
196197 {
197198 var result = this . _client . Search < SomeOtherClass > ( s => s
@@ -216,5 +217,6 @@ public void SearchDoesntLowercaseStringFieldOverloadInSearch()
216217 ) ;
217218 StringAssert . DoesNotContain ( "createDate2" , result . ConnectionStatus . Request . Utf8String ( ) ) ;
218219 }
220+
219221 }
220222}
0 commit comments