public void When_a_property_of_a_nested_object_doesnt_match_it_should_clearly_indicate_the_path() { //----------------------------------------------------------------------------------------------------------- // Arrange //----------------------------------------------------------------------------------------------------------- var c1 = new ClassOne(); var c2 = new ClassOne(); c2.RefOne.ValTwo = 2; //----------------------------------------------------------------------------------------------------------- // Act //----------------------------------------------------------------------------------------------------------- Action act = () => c1.ShouldBeEquivalentTo(c2); //----------------------------------------------------------------------------------------------------------- // Assert //----------------------------------------------------------------------------------------------------------- act.ShouldThrow<AssertFailedException>() .WithMessage("Expected property RefOne.ValTwo to be 2, but found 3", ComparisonMode.StartWith); }
public void When_two_objects_have_the_same_nested_objects_it_should_not_throw() { //----------------------------------------------------------------------------------------------------------- // Arrange //----------------------------------------------------------------------------------------------------------- var c1 = new ClassOne(); var c2 = new ClassOne(); //----------------------------------------------------------------------------------------------------------- // Act //----------------------------------------------------------------------------------------------------------- Action act = () => c1.ShouldBeEquivalentTo(c2); //----------------------------------------------------------------------------------------------------------- // Assert //----------------------------------------------------------------------------------------------------------- act.ShouldNotThrow(); }