public void ContactModel_UpdateModel_DateCreatedIsNotChanged() { //Arrange var expectedDate = DateTime.Now; var contact1 = new Contact() { ContactID = 1, Address = "123 Fake Street", City = "Fake City", DateCreated = expectedDate, FirstName = "Test", LastName = "Guy", PhoneNumber = "8016869999", State = "UT", ZipCode = "84102" }; var contact2 = new Contact() { ContactID = 198, Address = "123 Fake Street", City = "Fake City", DateCreated = DateTime.Now.AddDays(-20), FirstName = "Test Changed", LastName = "Guy", PhoneNumber = "8016869999", State = "UT", ZipCode = "84102" }; contact1.UpdateModel(ref contact2); Assert.Equal(contact1.DateCreated, expectedDate); }
public void ContactModel_UpdateModel_FirstNameIsChanged() { //Arrange const string originalName = "Test"; const string expectedName = "Test Changed"; var contact1 = new Contact() { ContactID = 1, Address = "123 Fake Street", City = "Fake City", DateCreated = DateTime.Now, FirstName = originalName, LastName = "Guy", PhoneNumber = "8016869999", State = "UT", ZipCode = "84102" }; var contact2 = new Contact() { ContactID = 198, Address = "123 Fake Street", City = "Fake City", DateCreated = DateTime.Now.AddDays(-20), FirstName = expectedName, LastName = "Guy", PhoneNumber = "8016869999", State = "UT", ZipCode = "84102" }; contact1.UpdateModel(ref contact2); Assert.Equal(contact1.FirstName, expectedName); }