11using System ;
22using System . Collections . Generic ;
3- using System . Linq ;
43using System . Linq . Expressions ;
5- using AutoMapper ;
64using Xunit ;
75
86namespace AutoMapper . Extensions . ExpressionMapping . UnitTests
@@ -118,8 +116,7 @@ public void Constructor_AddsMappingsFromDelegateTypes()
118116 typeof ( Func < DestModel , bool > ) ) ;
119117
120118 // Assert
121- Assert . True ( manager . TypeMappings . ContainsKey ( typeof ( SourceModel ) ) ) ;
122- Assert . Equal ( typeof ( DestModel ) , manager . TypeMappings [ typeof ( SourceModel ) ] ) ;
119+ Assert . Contains ( new KeyValuePair < Type , Type > ( typeof ( SourceModel ) , typeof ( DestModel ) ) , manager . TypeMappings ) ;
123120 }
124121
125122 #endregion
@@ -143,8 +140,7 @@ public void AddTypeMapping_SimpleTypes_AddsMapping()
143140 manager . AddTypeMapping ( typeof ( SourceChild ) , typeof ( DestChild ) ) ;
144141
145142 // Assert
146- Assert . True ( manager . TypeMappings . ContainsKey ( typeof ( SourceChild ) ) ) ;
147- Assert . Equal ( typeof ( DestChild ) , manager . TypeMappings [ typeof ( SourceChild ) ] ) ;
143+ Assert . Contains ( new KeyValuePair < Type , Type > ( typeof ( SourceChild ) , typeof ( DestChild ) ) , manager . TypeMappings ) ;
148144 }
149145
150146 [ Fact ]
@@ -187,8 +183,7 @@ public void AddTypeMapping_ExpressionTypes_UnwrapsAndAddsMapping()
187183 typeof ( Expression < Func < DestChild , bool > > ) ) ;
188184
189185 // Assert
190- Assert . True ( manager . TypeMappings . ContainsKey ( typeof ( Func < SourceChild , bool > ) ) ) ;
191- Assert . Equal ( typeof ( Func < DestChild , bool > ) , manager . TypeMappings [ typeof ( Func < SourceChild , bool > ) ] ) ;
186+ Assert . Contains ( new KeyValuePair < Type , Type > ( typeof ( Func < SourceChild , bool > ) , typeof ( Func < DestChild , bool > ) ) , manager . TypeMappings ) ;
192187 }
193188
194189 [ Fact ]
@@ -231,9 +226,8 @@ public void AddTypeMapping_ListTypes_AddsUnderlyingTypeMappings()
231226 manager . AddTypeMapping ( typeof ( List < SourceItem > ) , typeof ( List < DestItem > ) ) ;
232227
233228 // Assert
234- Assert . True ( manager . TypeMappings . ContainsKey ( typeof ( List < SourceItem > ) ) ) ;
235- Assert . True ( manager . TypeMappings . ContainsKey ( typeof ( SourceItem ) ) ) ;
236- Assert . Equal ( typeof ( DestItem ) , manager . TypeMappings [ typeof ( SourceItem ) ] ) ;
229+ Assert . Contains ( new KeyValuePair < Type , Type > ( typeof ( SourceItem ) , typeof ( DestItem ) ) , manager . TypeMappings ) ;
230+ Assert . Contains ( new KeyValuePair < Type , Type > ( typeof ( List < SourceItem > ) , typeof ( List < DestItem > ) ) , manager . TypeMappings ) ;
237231 }
238232
239233 [ Fact ]
@@ -254,9 +248,8 @@ public void AddTypeMapping_ArrayTypes_AddsUnderlyingTypeMappings()
254248 manager . AddTypeMapping ( typeof ( SourceItem [ ] ) , typeof ( DestItem [ ] ) ) ;
255249
256250 // Assert
257- Assert . True ( manager . TypeMappings . ContainsKey ( typeof ( SourceItem [ ] ) ) ) ;
258- Assert . True ( manager . TypeMappings . ContainsKey ( typeof ( SourceItem ) ) ) ;
259- Assert . Equal ( typeof ( DestItem ) , manager . TypeMappings [ typeof ( SourceItem ) ] ) ;
251+ Assert . Contains ( new KeyValuePair < Type , Type > ( typeof ( SourceItem ) , typeof ( DestItem ) ) , manager . TypeMappings ) ;
252+ Assert . Contains ( new KeyValuePair < Type , Type > ( typeof ( SourceItem [ ] ) , typeof ( DestItem [ ] ) ) , manager . TypeMappings ) ;
260253 }
261254
262255 #endregion
@@ -589,8 +582,7 @@ public void AddTypeMappingsFromDelegates_MatchingArgumentCounts_AddsMappings()
589582 typeof ( Func < DestChild , string > ) ) ;
590583
591584 // Assert
592- Assert . True ( manager . TypeMappings . ContainsKey ( typeof ( SourceChild ) ) ) ;
593- Assert . Equal ( typeof ( DestChild ) , manager . TypeMappings [ typeof ( SourceChild ) ] ) ;
585+ Assert . Contains ( new KeyValuePair < Type , Type > ( typeof ( SourceChild ) , typeof ( DestChild ) ) , manager . TypeMappings ) ;
594586 }
595587
596588 [ Fact ]
@@ -633,8 +625,7 @@ public void AddTypeMappingsFromDelegates_ActionTypes_AddsMappings()
633625 typeof ( Action < DestChild > ) ) ;
634626
635627 // Assert
636- Assert . True ( manager . TypeMappings . ContainsKey ( typeof ( SourceChild ) ) ) ;
637- Assert . Equal ( typeof ( DestChild ) , manager . TypeMappings [ typeof ( SourceChild ) ] ) ;
628+ Assert . Contains ( new KeyValuePair < Type , Type > ( typeof ( SourceChild ) , typeof ( DestChild ) ) , manager . TypeMappings ) ;
638629 }
639630
640631 #endregion
0 commit comments