@@ -22,7 +22,6 @@ public void SetUp()
22
22
}
23
23
24
24
#endregion SetUp
25
-
26
25
[ Test ]
27
26
public void MapTo_CorrectDestinationAndSourceExpressions_MappedCorrectly ( )
28
27
{
@@ -34,8 +33,8 @@ public void MapTo_CorrectDestinationAndSourceExpressions_MappedCorrectly()
34
33
35
34
// Act & Assert
36
35
37
- Assert . NotNull ( dto = mapper . Map < FoodDto > ( source ) ) ;
38
- Assert . AreEqual ( dto . Type , source . Category ) ;
36
+ Assert . That ( dto = mapper . Map < FoodDto > ( source ) , Is . Not . Null ) ;
37
+ Assert . That ( dto . Type , Is . EqualTo ( source . Category ) ) ;
39
38
}
40
39
41
40
[ Test ]
@@ -47,11 +46,11 @@ public void MapTo_CorrectDestinationAndSourceExpressions_ValidMappingCreated()
47
46
48
47
// Act & Assert
49
48
50
- Assert . DoesNotThrow ( ( ) => cfg = new MapperConfiguration ( c => c . CreateMap < FoodSource , FoodDto > ( )
49
+ Assert . That ( ( ) => cfg = new MapperConfiguration ( c => c . CreateMap < FoodSource , FoodDto > ( )
51
50
. MapTo ( d => d . Type , s => s . Category )
52
- . MapTo ( d => d . Source , s => s ) ) ) ;
53
- Assert . DoesNotThrow ( ( ) => cfg . AssertConfigurationIsValid ( ) ) ;
54
- Assert . DoesNotThrow ( ( ) => cfg . CreateMapper ( ) ) ;
51
+ . MapTo ( d => d . Source , s => s ) ) , Throws . Nothing ) ;
52
+ Assert . That ( ( ) => cfg . AssertConfigurationIsValid ( ) , Throws . Nothing ) ;
53
+ Assert . That ( ( ) => cfg . CreateMapper ( ) , Throws . Nothing ) ;
55
54
}
56
55
57
56
[ Test ]
@@ -65,8 +64,8 @@ public void MapTo_CorrectDestinationExpressionAndSourcePath_MappedCorrectly()
65
64
66
65
// Act & Assert
67
66
68
- Assert . NotNull ( dto = mapper . Map < FoodDto > ( source ) ) ;
69
- Assert . AreEqual ( dto . Type , source . Category ) ;
67
+ Assert . That ( dto = mapper . Map < FoodDto > ( source ) , Is . Not . Null ) ;
68
+ Assert . That ( dto . Type , Is . EqualTo ( source . Category ) ) ;
70
69
}
71
70
72
71
[ Test ]
@@ -78,11 +77,11 @@ public void MapTo_CorrectDestinationExpressionAndSourcePath_ValidMappingCreated(
78
77
79
78
// Act & Assert
80
79
81
- Assert . DoesNotThrow ( ( ) => cfg = new MapperConfiguration ( c => c . CreateMap < FoodSource , FoodDto > ( )
80
+ Assert . That ( ( ) => cfg = new MapperConfiguration ( c => c . CreateMap < FoodSource , FoodDto > ( )
82
81
. MapTo ( d => d . Type , "Category" )
83
- . MapTo ( d => d . Source , s => s ) ) ) ;
84
- Assert . DoesNotThrow ( ( ) => cfg . AssertConfigurationIsValid ( ) ) ;
85
- Assert . DoesNotThrow ( ( ) => cfg . CreateMapper ( ) ) ;
82
+ . MapTo ( d => d . Source , s => s ) ) , Throws . Nothing ) ;
83
+ Assert . That ( ( ) => cfg . AssertConfigurationIsValid ( ) , Throws . Nothing ) ;
84
+ Assert . That ( ( ) => cfg . CreateMapper ( ) , Throws . Nothing ) ;
86
85
}
87
86
88
87
[ Test ]
@@ -94,14 +93,14 @@ public void MapTo_NullDestinationMemberExpression_ThrowsAutoMapperConfigurationE
94
93
95
94
// Act & Assert
96
95
97
- Assert . Throws < AutoMapperConfigurationException > ( ( ) => new MapperConfiguration ( c => c . CreateMap < FoodSource , FoodDto > ( )
98
- . MapTo ( nullDestinationExpression ! , s => s . Category ) ) ) ;
96
+ Assert . That ( ( ) => new MapperConfiguration ( c => c . CreateMap < FoodSource , FoodDto > ( )
97
+ . MapTo ( nullDestinationExpression ! , s => s . Category ) ) , Throws . TypeOf < AutoMapperConfigurationException > ( ) ) ;
99
98
100
- Assert . Throws < AutoMapperConfigurationException > ( ( ) => new MapperConfiguration ( c => c . CreateMap < FoodSource , FoodDto > ( )
101
- . MapTo ( nullDestinationExpression ! , "Category" ) ) ) ;
99
+ Assert . That ( ( ) => new MapperConfiguration ( c => c . CreateMap < FoodSource , FoodDto > ( )
100
+ . MapTo ( nullDestinationExpression ! , "Category" ) ) , Throws . TypeOf < AutoMapperConfigurationException > ( ) ) ;
102
101
103
- Assert . Throws < ArgumentException > ( ( ) => new MapperConfiguration ( c => c . CreateMap < FoodSource , FoodDto > ( )
104
- . MapTo ( d => null , s => s . Category ) ) ) ;
102
+ Assert . That ( ( ) => new MapperConfiguration ( c => c . CreateMap < FoodSource , FoodDto > ( )
103
+ . MapTo ( d => null , s => s . Category ) ) , Throws . TypeOf < ArgumentException > ( ) ) ;
105
104
}
106
105
107
106
[ Test ]
@@ -113,19 +112,19 @@ public void MapTo_NullOrEmptyDestinationMemberName_ThrowsAutoMapperConfiguration
113
112
114
113
// Act & Assert
115
114
116
- Assert . Throws < AutoMapperConfigurationException > ( ( ) => new MapperConfiguration ( c => c . CreateMap < FoodSource , FoodDto > ( )
117
- . MapTo ( nullDestinationName ! , s => s . Category ) ) ) ;
118
- Assert . Throws < AutoMapperConfigurationException > ( ( ) => new MapperConfiguration ( c => c . CreateMap < FoodSource , FoodDto > ( )
119
- . MapTo ( "" , s => s . Category ) ) ) ;
120
- Assert . Throws < AutoMapperConfigurationException > ( ( ) => new MapperConfiguration ( c => c . CreateMap < FoodSource , FoodDto > ( )
121
- . MapTo ( " " , s => s . Category ) ) ) ;
122
-
123
- Assert . Throws < AutoMapperConfigurationException > ( ( ) => new MapperConfiguration ( c => c . CreateMap < FoodSource , FoodDto > ( )
124
- . MapTo ( nullDestinationName ! , "Category" ) ) ) ;
125
- Assert . Throws < AutoMapperConfigurationException > ( ( ) => new MapperConfiguration ( c => c . CreateMap < FoodSource , FoodDto > ( )
126
- . MapTo ( "" , "Category" ) ) ) ;
127
- Assert . Throws < AutoMapperConfigurationException > ( ( ) => new MapperConfiguration ( c => c . CreateMap < FoodSource , FoodDto > ( )
128
- . MapTo ( " " , "Category" ) ) ) ;
115
+ Assert . That ( ( ) => new MapperConfiguration ( c => c . CreateMap < FoodSource , FoodDto > ( )
116
+ . MapTo ( nullDestinationName ! , s => s . Category ) ) , Throws . TypeOf < AutoMapperConfigurationException > ( ) ) ;
117
+ Assert . That ( ( ) => new MapperConfiguration ( c => c . CreateMap < FoodSource , FoodDto > ( )
118
+ . MapTo ( "" , s => s . Category ) ) , Throws . TypeOf < AutoMapperConfigurationException > ( ) ) ;
119
+ Assert . That ( ( ) => new MapperConfiguration ( c => c . CreateMap < FoodSource , FoodDto > ( )
120
+ . MapTo ( " " , s => s . Category ) ) , Throws . TypeOf < AutoMapperConfigurationException > ( ) ) ;
121
+
122
+ Assert . That ( ( ) => new MapperConfiguration ( c => c . CreateMap < FoodSource , FoodDto > ( )
123
+ . MapTo ( nullDestinationName ! , "Category" ) ) , Throws . TypeOf < AutoMapperConfigurationException > ( ) ) ;
124
+ Assert . That ( ( ) => new MapperConfiguration ( c => c . CreateMap < FoodSource , FoodDto > ( )
125
+ . MapTo ( "" , "Category" ) ) , Throws . TypeOf < AutoMapperConfigurationException > ( ) ) ;
126
+ Assert . That ( ( ) => new MapperConfiguration ( c => c . CreateMap < FoodSource , FoodDto > ( )
127
+ . MapTo ( " " , "Category" ) ) , Throws . TypeOf < AutoMapperConfigurationException > ( ) ) ;
129
128
}
130
129
131
130
[ Test ]
@@ -137,19 +136,19 @@ public void MapTo_NullOrEmptySourceMemberPath_ThrowsAutoMapperConfigurationExcep
137
136
138
137
// Act & Assert
139
138
140
- Assert . Throws < AutoMapperConfigurationException > ( ( ) => new MapperConfiguration ( c => c . CreateMap < FoodSource , FoodDto > ( )
141
- . MapTo ( d => d . Type , nullSourcePath ! ) ) ) ;
142
- Assert . Throws < AutoMapperConfigurationException > ( ( ) => new MapperConfiguration ( c => c . CreateMap < FoodSource , FoodDto > ( )
143
- . MapTo ( d => d . Type , "" ) ) ) ;
144
- Assert . Throws < AutoMapperConfigurationException > ( ( ) => new MapperConfiguration ( c => c . CreateMap < FoodSource , FoodDto > ( )
145
- . MapTo ( d => d . Type , " " ) ) ) ;
146
-
147
- Assert . Throws < AutoMapperConfigurationException > ( ( ) => new MapperConfiguration ( c => c . CreateMap < FoodSource , FoodDto > ( )
148
- . MapTo ( "Type" , nullSourcePath ! ) ) ) ;
149
- Assert . Throws < AutoMapperConfigurationException > ( ( ) => new MapperConfiguration ( c => c . CreateMap < FoodSource , FoodDto > ( )
150
- . MapTo ( "Type" , "" ) ) ) ;
151
- Assert . Throws < AutoMapperConfigurationException > ( ( ) => new MapperConfiguration ( c => c . CreateMap < FoodSource , FoodDto > ( )
152
- . MapTo ( "Type" , " " ) ) ) ;
139
+ Assert . That ( ( ) => new MapperConfiguration ( c => c . CreateMap < FoodSource , FoodDto > ( )
140
+ . MapTo ( d => d . Type , nullSourcePath ! ) ) , Throws . TypeOf < AutoMapperConfigurationException > ( ) ) ;
141
+ Assert . That ( ( ) => new MapperConfiguration ( c => c . CreateMap < FoodSource , FoodDto > ( )
142
+ . MapTo ( d => d . Type , "" ) ) , Throws . TypeOf < AutoMapperConfigurationException > ( ) ) ;
143
+ Assert . That ( ( ) => new MapperConfiguration ( c => c . CreateMap < FoodSource , FoodDto > ( )
144
+ . MapTo ( d => d . Type , " " ) ) , Throws . TypeOf < AutoMapperConfigurationException > ( ) ) ;
145
+
146
+ Assert . That ( ( ) => new MapperConfiguration ( c => c . CreateMap < FoodSource , FoodDto > ( )
147
+ . MapTo ( "Type" , nullSourcePath ! ) ) , Throws . TypeOf < AutoMapperConfigurationException > ( ) ) ;
148
+ Assert . That ( ( ) => new MapperConfiguration ( c => c . CreateMap < FoodSource , FoodDto > ( )
149
+ . MapTo ( "Type" , "" ) ) , Throws . TypeOf < AutoMapperConfigurationException > ( ) ) ;
150
+ Assert . That ( ( ) => new MapperConfiguration ( c => c . CreateMap < FoodSource , FoodDto > ( )
151
+ . MapTo ( "Type" , " " ) ) , Throws . TypeOf < AutoMapperConfigurationException > ( ) ) ;
153
152
}
154
153
155
154
[ Test ]
@@ -165,8 +164,8 @@ public void MapTo_NullSourceMemberExpression_MappedCorrectly()
165
164
166
165
// Act & Assert
167
166
168
- Assert . NotNull ( dto = mapper . Map < FoodDto > ( source ) ) ;
169
- Assert . AreEqual ( dto . Source , source . ToString ( ) ) ;
167
+ Assert . That ( dto = mapper . Map < FoodDto > ( source ) , Is . Not . Null ) ;
168
+ Assert . That ( dto . Source , Is . EqualTo ( source . ToString ( ) ) ) ;
170
169
171
170
// Arrange
172
171
@@ -176,8 +175,8 @@ public void MapTo_NullSourceMemberExpression_MappedCorrectly()
176
175
177
176
// Act & Assert
178
177
179
- Assert . NotNull ( dto = mapper . Map < FoodDto > ( source ) ) ;
180
- Assert . AreEqual ( dto . Source , source . ToString ( ) ) ;
178
+ Assert . That ( dto = mapper . Map < FoodDto > ( source ) , Is . Not . Null ) ;
179
+ Assert . That ( dto . Source , Is . EqualTo ( source . ToString ( ) ) ) ;
181
180
}
182
181
183
182
[ Test ]
@@ -190,15 +189,15 @@ public void MapTo_NullSourceMemberExpression_ValidMappingCreated()
190
189
191
190
// Act & Assert
192
191
193
- Assert . DoesNotThrow ( ( ) => cfg = new MapperConfiguration ( c => c . CreateMap < FoodSource , FoodDto > ( )
192
+ Assert . That ( ( ) => cfg = new MapperConfiguration ( c => c . CreateMap < FoodSource , FoodDto > ( )
194
193
. MapTo ( d => d . Type , nullSourceExpression )
195
- . MapTo ( d => d . Source , nullSourceExpression ) ) ) ;
196
- Assert . DoesNotThrow ( ( ) => cfg . AssertConfigurationIsValid ( ) ) ;
194
+ . MapTo ( d => d . Source , nullSourceExpression ) ) , Throws . Nothing ) ;
195
+ Assert . That ( ( ) => cfg . AssertConfigurationIsValid ( ) , Throws . Nothing ) ;
197
196
198
- Assert . DoesNotThrow ( ( ) => cfg = new MapperConfiguration ( c => c . CreateMap < FoodSource , FoodDto > ( )
197
+ Assert . That ( ( ) => cfg = new MapperConfiguration ( c => c . CreateMap < FoodSource , FoodDto > ( )
199
198
. MapTo ( "Type" , nullSourceExpression )
200
- . MapTo ( d => d . Source , nullSourceExpression ) ) ) ;
201
- Assert . DoesNotThrow ( ( ) => cfg . AssertConfigurationIsValid ( ) ) ;
199
+ . MapTo ( d => d . Source , nullSourceExpression ) ) , Throws . Nothing ) ;
200
+ Assert . That ( ( ) => cfg . AssertConfigurationIsValid ( ) , Throws . Nothing ) ;
202
201
}
203
202
204
203
[ Test ]
@@ -212,8 +211,8 @@ public void MapTo_NullValueSourceMemberExpression_MappedCorrectly()
212
211
213
212
// Act & Assert
214
213
215
- Assert . NotNull ( dto = mapper . Map < FoodDto > ( source ) ) ;
216
- Assert . AreEqual ( dto . Type , null ) ;
214
+ Assert . That ( dto = mapper . Map < FoodDto > ( source ) , Is . Not . Null ) ;
215
+ Assert . That ( dto . Type , Is . Null ) ;
217
216
218
217
// Arrange
219
218
@@ -223,8 +222,8 @@ public void MapTo_NullValueSourceMemberExpression_MappedCorrectly()
223
222
224
223
// Act & Assert
225
224
226
- Assert . NotNull ( dto = mapper . Map < FoodDto > ( source ) ) ;
227
- Assert . AreEqual ( dto . Type , null ) ;
225
+ Assert . That ( dto = mapper . Map < FoodDto > ( source ) , Is . Not . Null ) ;
226
+ Assert . That ( dto . Type , Is . Null ) ;
228
227
}
229
228
230
229
[ Test ]
@@ -236,15 +235,15 @@ public void MapTo_NullValueSourceMemberExpression_ValidMappingCreated()
236
235
237
236
// Act & Assert
238
237
239
- Assert . DoesNotThrow ( ( ) => cfg = new MapperConfiguration ( c => c . CreateMap < FoodSource , FoodDto > ( )
238
+ Assert . That ( ( ) => cfg = new MapperConfiguration ( c => c . CreateMap < FoodSource , FoodDto > ( )
240
239
. MapTo ( d => d . Type , s => null )
241
- . MapTo ( d => d . Source , s => null ) ) ) ;
242
- Assert . DoesNotThrow ( ( ) => cfg . AssertConfigurationIsValid ( ) ) ;
240
+ . MapTo ( d => d . Source , s => null ) ) , Throws . Nothing ) ;
241
+ Assert . That ( ( ) => cfg . AssertConfigurationIsValid ( ) , Throws . Nothing ) ;
243
242
244
- Assert . DoesNotThrow ( ( ) => cfg = new MapperConfiguration ( c => c . CreateMap < FoodSource , FoodDto > ( )
243
+ Assert . That ( ( ) => cfg = new MapperConfiguration ( c => c . CreateMap < FoodSource , FoodDto > ( )
245
244
. MapTo ( "Type" , s => null )
246
- . MapTo ( "Source" , s => null ) ) ) ;
247
- Assert . DoesNotThrow ( ( ) => cfg . AssertConfigurationIsValid ( ) ) ;
245
+ . MapTo ( "Source" , s => null ) ) , Throws . Nothing ) ;
246
+ Assert . That ( ( ) => cfg . AssertConfigurationIsValid ( ) , Throws . Nothing ) ;
248
247
}
249
248
250
249
[ Test ]
@@ -258,8 +257,8 @@ public void MapTo_WithoutSourceMemberExpression_MappedCorrectly()
258
257
259
258
// Act & Assert
260
259
261
- Assert . NotNull ( dto = mapper . Map < FoodDto > ( source ) ) ;
262
- Assert . AreEqual ( dto . Source , source . ToString ( ) ) ;
260
+ Assert . That ( dto = mapper . Map < FoodDto > ( source ) , Is . Not . Null ) ;
261
+ Assert . That ( dto . Source , Is . EqualTo ( source . ToString ( ) ) ) ;
263
262
264
263
// Arrange
265
264
@@ -269,8 +268,8 @@ public void MapTo_WithoutSourceMemberExpression_MappedCorrectly()
269
268
270
269
// Act & Assert
271
270
272
- Assert . NotNull ( dto = mapper . Map < FoodDto > ( source ) ) ;
273
- Assert . AreEqual ( dto . Source , source . ToString ( ) ) ;
271
+ Assert . That ( dto = mapper . Map < FoodDto > ( source ) , Is . Not . Null ) ;
272
+ Assert . That ( dto . Source , Is . EqualTo ( source . ToString ( ) ) ) ;
274
273
}
275
274
276
275
[ Test ]
@@ -282,14 +281,14 @@ public void MapTo_WithoutSourceMemberExpression_ValidMappingCreated()
282
281
283
282
// Act & Assert
284
283
285
- Assert . DoesNotThrow ( ( ) => cfg = new MapperConfiguration ( c => c . CreateMap < FoodSource , FoodDto > ( )
284
+ Assert . That ( ( ) => cfg = new MapperConfiguration ( c => c . CreateMap < FoodSource , FoodDto > ( )
286
285
. MapTo ( d => d . Type )
287
- . MapTo ( d => d . Source ) ) ) ;
288
- Assert . DoesNotThrow ( ( ) => cfg . AssertConfigurationIsValid ( ) ) ;
286
+ . MapTo ( d => d . Source ) ) , Throws . Nothing ) ;
287
+ Assert . That ( ( ) => cfg . AssertConfigurationIsValid ( ) , Throws . Nothing ) ;
289
288
290
- Assert . DoesNotThrow ( ( ) => cfg = new MapperConfiguration ( c => c . CreateMap < FoodSource , FoodDto > ( )
289
+ Assert . That ( ( ) => cfg = new MapperConfiguration ( c => c . CreateMap < FoodSource , FoodDto > ( )
291
290
. MapTo ( "Type" )
292
- . MapTo ( "Source" ) ) ) ;
293
- Assert . DoesNotThrow ( ( ) => cfg . AssertConfigurationIsValid ( ) ) ;
291
+ . MapTo ( "Source" ) ) , Throws . Nothing ) ;
292
+ Assert . That ( ( ) => cfg . AssertConfigurationIsValid ( ) , Throws . Nothing ) ;
294
293
}
295
294
}
0 commit comments