11using ObjectSemantics . NET . Tests . MoqModels ;
22using System . Collections . Generic ;
3- using System . Linq ;
43using Xunit ;
54
65namespace ObjectSemantics . NET . Tests
@@ -25,7 +24,7 @@ public void Should_Map_Enumerable_Collection_SingleLine()
2524
2625 string result = person . Map ( template ) ;
2726
28- string expectedResult = $ "I own a { person . MyCars [ 0 ] . Year } { person . MyCars [ 0 ] . Make } . I own a { person . MyCars [ 1 ] . Year } { person . MyCars [ 1 ] . Make } .";
27+ string expectedResult = $ "I own a 2023 BMW. I own a 2020 Rolls-Royce .";
2928 Assert . Equal ( expectedResult , result ) ;
3029 }
3130
@@ -51,16 +50,17 @@ public void Should_Map_Enumerable_Collection_MultiLine()
5150
5251 string result = person . Map ( template ) ;
5352
54- string expectedResult = @$ "
55- { person . Name } 's Cars
56- - { person . MyCars [ 0 ] . Year } { person . MyCars [ 0 ] . Make }
57- - { person . MyCars [ 1 ] . Year } { person . MyCars [ 1 ] . Make }
53+ string expectedResult = @"
54+ John Doe's Cars
55+
56+ - 2023 BMW
57+
58+ - 2020 Rolls-Royce
5859" ;
5960 Assert . Equal ( expectedResult , result ) ;
6061 }
6162
6263
63-
6464 [ Fact ]
6565 public void Should_Map_Multiple_Enumerable_Collections ( )
6666 {
@@ -92,13 +92,19 @@ My Dream Cars
9292
9393 string result = person . Map ( template ) ;
9494
95- string expectedResult = @$ "
95+ string expectedResult = @"
9696My Cars
97- - { person . MyCars [ 0 ] . Make }
98- - { person . MyCars [ 1 ] . Make }
97+
98+ - Honda
99+
100+ - Toyota
101+
99102My Dream Cars
100- - { person . MyDreamCars [ 0 ] . Make }
101- - { person . MyDreamCars [ 1 ] . Make }
103+
104+ * BWM
105+
106+ * Rolls-Royce
107+
102108" ;
103109 Assert . Equal ( expectedResult , result ) ;
104110 }
@@ -115,7 +121,7 @@ public void Should_Map_Array_Of_String()
115121 string template = @"{{ #foreach(MyFriends) }} {{ . }} {{ #endforeach }}" ;
116122
117123 string generatedTemplate = person . Map ( template ) ;
118- string expectedResult = string . Join ( string . Empty , person . MyFriends ) ;
124+ string expectedResult = " Morgan George Jane " ;
119125 Assert . Equal ( expectedResult , generatedTemplate , false , true , true ) ;
120126 }
121127
@@ -131,7 +137,7 @@ public void Should_Map_Array_Of_String_With_Formatting()
131137 string template = @"{{ #foreach(MyFriends) }} {{ .:uppercase }} {{ #endforeach }}" ;
132138
133139 string generatedTemplate = person . Map ( template ) ;
134- string expectedResult = string . Join ( string . Empty , person . MyFriends . Select ( x => x . ToUpper ( ) ) ) ;
140+ string expectedResult = " MORGAN GEORGE JANE " ;
135141 Assert . Equal ( expectedResult , generatedTemplate , false , true , true ) ;
136142 }
137143 }
0 commit comments