1- using System . Collections . Generic ;
1+ using System ;
2+ using System . Collections . Generic ;
23using System . Linq ;
34using AutoMapper . EquivalencyExpression ;
45using FluentAssertions ;
@@ -43,23 +44,23 @@ public void Should_not_throw_exception_for_nonexisting_types()
4344 assertModel . Contacts . Single ( ) . Name . Should ( ) . Be ( originalModel . Contacts . Single ( ) . Name ) ;
4445 assertModel . Contacts . Single ( ) . Emails . Single ( ) . Address . Should ( ) . Be ( originalModel . Contacts . Single ( ) . Emails . Single ( ) . Address ) ;
4546
47+ assertModel . Contacts . Single ( ) . Emails . Add ( new EmailViewModel { Address = "[email protected] " } ) ; 48+
4649 mapper . Map ( assertModel , originalModel ) ;
47- // This tests if equality was found and mapped to pre-existing object and not defaulting to AM and clearing and regenerating the list
48- originalModel . Contacts . Single ( ) . Emails . Single ( ) . Should ( ) . Be ( originalEmail ) ;
4950 }
5051
5152 public class System
5253 {
53- public int Id { get ; set ; }
54+ public Guid Id { get ; set ; } = Guid . NewGuid ( ) ;
5455 public string Name { get ; set ; }
5556
5657 public ICollection < Contact > Contacts { get ; set ; }
5758 }
5859
5960 public class Contact
6061 {
61- public int Id { get ; set ; }
62- public int SystemId { get ; set ; }
62+ public Guid Id { get ; set ; } = Guid . NewGuid ( ) ;
63+ public Guid SystemId { get ; set ; }
6364 public string Name { get ; set ; }
6465
6566 public System System { get ; set ; }
@@ -69,26 +70,26 @@ public class Contact
6970
7071 public class Email
7172 {
72- public int Id { get ; set ; }
73+ public Guid Id { get ; set ; } = Guid . NewGuid ( ) ;
7374
74- public int ContactId { get ; set ; }
75+ public Guid ContactId { get ; set ; }
7576 public string Address { get ; set ; }
7677
7778 public Contact Contact { get ; set ; }
7879 }
7980
8081 public class SystemViewModel
8182 {
82- public int Id { get ; set ; }
83+ public Guid Id { get ; set ; }
8384 public string Name { get ; set ; }
8485
8586 public ICollection < ContactViewModel > Contacts { get ; set ; }
8687 }
8788
8889 public class ContactViewModel
8990 {
90- public int Id { get ; set ; }
91- public int SystemId { get ; set ; }
91+ public Guid Id { get ; set ; }
92+ public Guid SystemId { get ; set ; }
9293 public string Name { get ; set ; }
9394
9495 public SystemViewModel System { get ; set ; }
@@ -98,8 +99,8 @@ public class ContactViewModel
9899
99100 public class EmailViewModel
100101 {
101- public int Id { get ; set ; }
102- public int ContactId { get ; set ; }
102+ public Guid Id { get ; set ; }
103+ public Guid ContactId { get ; set ; }
103104 public string Address { get ; set ; }
104105
105106 public ContactViewModel Contact { get ; set ; }
0 commit comments