@@ -210,6 +210,84 @@ public void Should_Work_With_Null_Destination()
210210            Mapper . Map < List < Thing > > ( dtos ) . Should ( ) . HaveSameCount ( dtos ) ; 
211211        } 
212212
213+         public  void  Should_Work_With_Comparing_String_Types ( ) 
214+         { 
215+             Mapper . Initialize ( cfg => 
216+             { 
217+                 cfg . AddCollectionMappers ( ) ; 
218+                 cfg . CreateMap < Charge ,  SaleCharge > ( ) 
219+                     . ForMember ( d =>  d . SaleId ,  o =>  o . Ignore ( ) ) 
220+                     . EqualityComparison ( ( c ,  sc )  =>  sc . Category  ==  c . Category  &&  sc . Description  ==  c . Description ) ; 
221+ 
222+                 cfg . CreateMap < SaleCharge ,  Charge > ( ) 
223+                     . ConstructUsing ( 
224+                         ( saleCharge =>  new  Charge ( saleCharge . Category ,  saleCharge . Description ,  saleCharge . Value ) ) ) 
225+                     . EqualityComparison ( ( sc ,  c )  =>  sc . Category  ==  c . Category  &&  sc . Description  ==  c . Description ) ; 
226+             } ) ; 
227+ 
228+             var  dto  =  new  Charge ( "catagory" ,  "description" ,  5 ) ; 
229+             var  entity  =  new  SaleCharge  {  Category  =  dto . Category ,  Description  =  dto . Description  } ; 
230+             var  entityCollection  =  new  List < SaleCharge >  {  entity  } ; 
231+ 
232+             Mapper . Map ( new [ ]  {  dto  } ,  entityCollection ) ; 
233+ 
234+             entity . ShouldBeEquivalentTo ( entityCollection [ 0 ] ) ; 
235+         } 
236+ 
237+         public  class  Charge 
238+         { 
239+             public  Charge ( string  category ,  string  description ,  decimal  value ) 
240+             { 
241+                 Category  =  category ; 
242+                 Description  =  description ; 
243+                 Value  =  value ; 
244+             } 
245+ 
246+             public  string  Category  {  get ;  } 
247+             public  string  Description  {  get ;  } 
248+             public  decimal  Value  {  get ;  } 
249+ 
250+             public  override  string  ToString ( ) 
251+             { 
252+                 return  $ "{ Category } |{ Description } |{ Value } "; 
253+             } 
254+ 
255+             public  override  int  GetHashCode ( ) 
256+             { 
257+                 return  $ "{ Category } |{ Description } |{ Value } ". GetHashCode ( ) ; 
258+             } 
259+ 
260+             public  override  bool  Equals ( object  obj ) 
261+             { 
262+                 if  ( ReferenceEquals ( this ,  obj ) ) 
263+                 { 
264+                     return  true ; 
265+                 } 
266+ 
267+                 if  ( ReferenceEquals ( null ,  obj ) ) 
268+                 { 
269+                     return  false ; 
270+                 } 
271+ 
272+                 var  _obj  =  obj  as  Charge ; 
273+ 
274+                 if  ( _obj  ==  null ) 
275+                 { 
276+                     return  false ; 
277+                 } 
278+ 
279+                 return  Category  ==  _obj . Category  &&  Description  ==  _obj . Description  &&  Value  ==  _obj . Value ; 
280+             } 
281+         } 
282+ 
283+         public  class  SaleCharge 
284+         { 
285+             public  Guid  SaleId  {  get ;  set ;  } 
286+             public  string  Category  {  get ;  set ;  } 
287+             public  string  Description  {  get ;  set ;  } 
288+             public  decimal  Value  {  get ;  set ;  } 
289+         } 
290+ 
213291        public  void  Should_Be_Instanced_Based ( ) 
214292        { 
215293            Mapper . Initialize ( x => 
0 commit comments