22using System . Linq . Expressions ;
33using Xunit ;
44using SolrNet . Linq . Expressions ;
5+ using SolrNet . Linq . Expressions . Context ;
56
67namespace SolrNet . Linq . Tests
78{
@@ -11,16 +12,16 @@ public class MemberExpressionExtensionsTest
1112 public void Member ( )
1213 {
1314 Expression < Func < Product , object > > exp = ( Product p ) => p . Popularity ;
14-
15- Assert . Equal ( "popularity" , exp . Body . GetSolrMemberProduct ( typeof ( Product ) ) ) ;
15+
16+ Assert . Equal ( "popularity" , MemberContext . ForType < Product > ( ) . GetSolrMemberProduct ( exp . Body ) ) ;
1617 }
1718
1819 [ Fact ]
1920 public void Div ( )
2021 {
2122 Expression < Func < Product , object > > exp = ( Product p ) => p . Popularity / 10 ;
2223
23- Assert . Equal ( "div(popularity,10)" , exp . Body . GetSolrMemberProduct ( typeof ( Product ) ) ) ;
24+ Assert . Equal ( "div(popularity,10)" , MemberContext . ForType < Product > ( ) . GetSolrMemberProduct ( exp . Body ) ) ;
2425 }
2526
2627 [ Fact ]
@@ -29,79 +30,79 @@ public void DivVariable()
2930 double qwe = 12 ;
3031 Expression < Func < Product , object > > exp = ( Product p ) => p . Sequence / qwe ;
3132
32- Assert . Equal ( "div(sequence_i,12)" , exp . Body . GetSolrMemberProduct ( typeof ( Product ) ) ) ;
33+ Assert . Equal ( "div(sequence_i,12)" , MemberContext . ForType < Product > ( ) . GetSolrMemberProduct ( exp . Body ) ) ;
3334 }
3435
3536 [ Fact ]
3637 public void Sub ( )
3738 {
3839 Expression < Func < Product , object > > exp = ( Product p ) => p . Popularity - 10 ;
3940
40- Assert . Equal ( "sub(popularity,10)" , exp . Body . GetSolrMemberProduct ( typeof ( Product ) ) ) ;
41+ Assert . Equal ( "sub(popularity,10)" , MemberContext . ForType < Product > ( ) . GetSolrMemberProduct ( exp . Body ) ) ;
4142 }
4243
4344 [ Fact ]
4445 public void Sum ( )
4546 {
4647 Expression < Func < Product , object > > exp = ( Product p ) => p . Popularity + 10 ;
4748
48- Assert . Equal ( "sum(popularity,10)" , exp . Body . GetSolrMemberProduct ( typeof ( Product ) ) ) ;
49+ Assert . Equal ( "sum(popularity,10)" , MemberContext . ForType < Product > ( ) . GetSolrMemberProduct ( exp . Body ) ) ;
4950 }
5051
5152 [ Fact ]
5253 public void Mul ( )
5354 {
5455 Expression < Func < Product , object > > exp = ( Product p ) => p . Popularity * 10 ;
5556
56- Assert . Equal ( "mul(popularity,10)" , exp . Body . GetSolrMemberProduct ( typeof ( Product ) ) ) ;
57+ Assert . Equal ( "mul(popularity,10)" , MemberContext . ForType < Product > ( ) . GetSolrMemberProduct ( exp . Body ) ) ;
5758 }
5859
5960 [ Fact ]
6061 public void Abs ( )
6162 {
6263 Expression < Func < Product , object > > exp = ( Product p ) => Math . Abs ( p . Sequence ) ;
6364
64- Assert . Equal ( "abs(sequence_i)" , exp . Body . GetSolrMemberProduct ( typeof ( Product ) ) ) ;
65+ Assert . Equal ( "abs(sequence_i)" , MemberContext . ForType < Product > ( ) . GetSolrMemberProduct ( exp . Body ) ) ;
6566 }
6667
6768 [ Fact ]
6869 public void Log ( )
6970 {
7071 Expression < Func < Product , object > > exp = ( Product p ) => Math . Log10 ( p . Sequence ) ;
7172
72- Assert . Equal ( "log(sequence_i)" , exp . Body . GetSolrMemberProduct ( typeof ( Product ) ) ) ;
73+ Assert . Equal ( "log(sequence_i)" , MemberContext . ForType < Product > ( ) . GetSolrMemberProduct ( exp . Body ) ) ;
7374 }
7475
7576 [ Fact ]
7677 public void Max ( )
7778 {
7879 Expression < Func < Product , object > > exp = ( Product p ) => Math . Max ( p . Sequence , 11 ) ;
7980
80- Assert . Equal ( "max(sequence_i,11)" , exp . Body . GetSolrMemberProduct ( typeof ( Product ) ) ) ;
81+ Assert . Equal ( "max(sequence_i,11)" , MemberContext . ForType < Product > ( ) . GetSolrMemberProduct ( exp . Body ) ) ;
8182 }
8283
8384 [ Fact ]
8485 public void Min ( )
8586 {
8687 Expression < Func < Product , object > > exp = ( Product p ) => Math . Min ( p . Sequence , 11 ) ;
8788
88- Assert . Equal ( "min(sequence_i,11)" , exp . Body . GetSolrMemberProduct ( typeof ( Product ) ) ) ;
89+ Assert . Equal ( "min(sequence_i,11)" , MemberContext . ForType < Product > ( ) . GetSolrMemberProduct ( exp . Body ) ) ;
8990 }
9091
9192 [ Fact ]
9293 public void Pow ( )
9394 {
9495 Expression < Func < Product , object > > exp = ( Product p ) => Math . Pow ( p . Sequence , 11 ) ;
9596
96- Assert . Equal ( "pow(sequence_i,11)" , exp . Body . GetSolrMemberProduct ( typeof ( Product ) ) ) ;
97+ Assert . Equal ( "pow(sequence_i,11)" , MemberContext . ForType < Product > ( ) . GetSolrMemberProduct ( exp . Body ) ) ;
9798 }
9899
99100 [ Fact ]
100101 public void Sqrt ( )
101102 {
102103 Expression < Func < Product , object > > exp = ( Product p ) => Math . Sqrt ( p . Sequence ) ;
103104
104- Assert . Equal ( "sqrt(sequence_i)" , exp . Body . GetSolrMemberProduct ( typeof ( Product ) ) ) ;
105+ Assert . Equal ( "sqrt(sequence_i)" , MemberContext . ForType < Product > ( ) . GetSolrMemberProduct ( exp . Body ) ) ;
105106 }
106107 }
107108}
0 commit comments