public void When_comparing_objects_by_their_shared_properties_and_all_match_it_should_not_throw() { //----------------------------------------------------------------------------------------------------------- // Arrange //----------------------------------------------------------------------------------------------------------- var dto = new CustomerDto { Version = 2, Age = 36, Birthdate = new DateTime(1973, 9, 20), Name = "John" }; var customer = new Customer { Id = 1, Version = 2, Age = 36, Birthdate = new DateTime(1973, 9, 20), Name = "John" }; //----------------------------------------------------------------------------------------------------------- // Act //----------------------------------------------------------------------------------------------------------- Action act = () => customer.ShouldHave().SharedProperties().EqualTo(dto); //----------------------------------------------------------------------------------------------------------- // Assert //----------------------------------------------------------------------------------------------------------- act.ShouldNotThrow(); }
public void When_comparing_objects_it_should_ignore_private_properties() { //----------------------------------------------------------------------------------------------------------- // Arrange //----------------------------------------------------------------------------------------------------------- var subject = new Customer("MyPassword") { Age = 36, Birthdate = new DateTime(1973, 9, 20), Name = "John", }; var other = new Customer("SomeOtherPassword") { Age = 36, Birthdate = new DateTime(1973, 9, 20), Name = "John" }; //----------------------------------------------------------------------------------------------------------- // Act //----------------------------------------------------------------------------------------------------------- Action act = () => subject.ShouldHave().AllProperties().EqualTo(other); //----------------------------------------------------------------------------------------------------------- // Assert //----------------------------------------------------------------------------------------------------------- act.ShouldNotThrow(); }