File tree Expand file tree Collapse file tree 2 files changed +25
-6
lines changed
TestStack.FluentMVCTesting.Tests/Internal
TestStack.FluentMvcTesting/Internal Expand file tree Collapse file tree 2 files changed +25
-6
lines changed Original file line number Diff line number Diff line change 11using NUnit . Framework ;
2+ using System ;
3+ using System . Linq . Expressions ;
4+ using TestStack . FluentMVCTesting . Internal ;
25
36namespace TestStack . FluentMVCTesting . Tests . Internal
47{
58 [ TestFixture ]
6- public class ExpressionInspectorTests
9+ public class ExpressionInspectorShould
710 {
8-
11+ [ Test ]
12+ public void Correctly_parse_equality_comparison_with_string_operands ( )
13+ {
14+ Expression < Func < string , bool > > func = text => text == "any" ;
15+ ExpressionInspector sut = new ExpressionInspector ( ) ;
16+ var actual = sut . Inspect ( func ) ;
17+ Assert . AreEqual ( "text => text == \" any\" " , actual ) ;
18+ }
19+
20+ [ Test ]
21+ public void Correctly_parse_equality_comparison_with_int_operands ( )
22+ {
23+ Expression < Func < int , bool > > func = number => number == 5 ;
24+ ExpressionInspector sut = new ExpressionInspector ( ) ;
25+ var actual = sut . Inspect ( func ) ;
26+ Assert . AreEqual ( "number => number == 5" , actual ) ;
27+ }
928 }
1029}
Original file line number Diff line number Diff line change 1- using System ;
2- using System . Linq . Expressions ;
1+ using System . Linq . Expressions ;
2+ using System . Text . RegularExpressions ;
33
44namespace TestStack . FluentMVCTesting . Internal
55{
66 internal class ExpressionInspector
77 {
8- internal void Inspect ( LambdaExpression expression )
8+ internal string Inspect ( LambdaExpression expression )
99 {
10- throw new NotImplementedException ( ) ;
10+ return Regex . Replace ( expression . ToString ( ) , "[()]" , "" ) ;
1111 }
1212 }
1313}
You can’t perform that action at this time.
0 commit comments