66
77namespace Nest . Tests . Integration . Aggregations
88{
9- [ TestFixture ]
10- public class TermsAggregationTests : IntegrationTests
11- {
12- [ Test ]
13- public void WrongFieldName ( )
14- {
9+ [ TestFixture ]
10+ public class TermsAggregationTests : IntegrationTests
11+ {
12+ [ Test ]
13+ public void WrongFieldName ( )
14+ {
1515 var results = this . _client . Search < ElasticsearchProject > ( s => s
1616 . Size ( 0 )
17- . Aggregations ( a=> a
18- . Terms ( "my_terms_agg" , t=> t
17+ . Aggregations ( a => a
18+ . Terms ( "my_terms_agg" , t => t
1919 . Field ( "this_field_name_does_not_exist" )
2020 )
2121 )
2222 ) ;
23- results . IsValid . Should ( ) . BeTrue ( ) ;
24- var termBucket = results . Aggs . Terms ( "my_terms_agg" ) ;
25- termBucket . Should ( ) . NotBeNull ( ) ;
26- termBucket . Items . Should ( ) . BeEmpty ( ) ;
27- }
28-
23+ results . IsValid . Should ( ) . BeTrue ( ) ;
24+ var termBucket = results . Aggs . Terms ( "my_terms_agg" ) ;
25+ termBucket . Should ( ) . NotBeNull ( ) ;
26+ termBucket . Items . Should ( ) . BeEmpty ( ) ;
27+ }
28+
2929 [ Test ]
30- public void ExistingFieldName ( )
31- {
30+ public void ExistingFieldName ( )
31+ {
3232 var results = this . _client . Search < ElasticsearchProject > ( s => s
3333 . Size ( 0 )
34- . Aggregations ( a=> a
35- . Terms ( "my_terms_agg" , t=> t
36- . Field ( p=> p . Name )
34+ . Aggregations ( a => a
35+ . Terms ( "my_terms_agg" , t => t
36+ . Field ( p => p . Name )
3737 )
3838 )
3939 ) ;
40- results . IsValid . Should ( ) . BeTrue ( ) ;
41- var termBucket = results . Aggs . Terms ( "my_terms_agg" ) ;
42- termBucket . Should ( ) . NotBeNull ( ) ;
43- termBucket . Items . Should ( ) . NotBeEmpty ( )
44- . And . OnlyContain ( i=> ! i . Key . IsNullOrEmpty ( ) )
45- . And . OnlyContain ( i=> i . DocCount > 0 ) ;
46- }
47-
40+ results . IsValid . Should ( ) . BeTrue ( ) ;
41+ var termBucket = results . Aggs . Terms ( "my_terms_agg" ) ;
42+ termBucket . Should ( ) . NotBeNull ( ) ;
43+ termBucket . Items . Should ( ) . NotBeEmpty ( )
44+ . And . OnlyContain ( i => ! i . Key . IsNullOrEmpty ( ) )
45+ . And . OnlyContain ( i => i . DocCount > 0 ) ;
46+ }
47+
4848 [ Test ]
49- public void NestedEmptyAggregationThreeLevelDeeps ( )
50- {
49+ public void NestedEmptyAggregationThreeLevelDeeps ( )
50+ {
5151 var results = this . _client . Search < ElasticsearchProject > ( s => s
5252 . Size ( 0 )
53- . Aggregations ( a=> a
54- . Terms ( "countries" , t=> t
55- . Field ( p=> p . Country )
56- . Aggregations ( aa=> aa
53+ . Aggregations ( a => a
54+ . Terms ( "countries" , t => t
55+ . Field ( p => p . Country )
56+ . Aggregations ( aa => aa
5757 . Terms ( "noop" , tt => tt . Field ( "noop" ) )
5858 . Terms ( "names" , tt => tt
59- . Field ( p=> p . Name )
60- . Aggregations ( aaa=> aaa
61- . Average ( "avg_loc" , avg=> avg . Field ( p=> p . LOC ) )
59+ . Field ( p => p . Name )
60+ . Aggregations ( aaa => aaa
61+ . Average ( "avg_loc" , avg => avg . Field ( p => p . LOC ) )
6262 )
6363 )
6464 )
@@ -93,6 +93,6 @@ public void NestedEmptyAggregationThreeLevelDeeps()
9393 average . Value . Should ( ) . HaveValue ( ) ;
9494 }
9595 }
96- }
97- }
96+ }
97+ }
9898}
0 commit comments