public void When_an_interface_reference_is_compared_it_should_ignore_other_properties() { //----------------------------------------------------------------------------------------------------------- // Arrange //----------------------------------------------------------------------------------------------------------- IVehicle expected = new Car { VehicleId = 1, Wheels = 4 }; IVehicle subject = new Car { VehicleId = 1, Wheels = 99999 }; //----------------------------------------------------------------------------------------------------------- // Act //----------------------------------------------------------------------------------------------------------- Action action = () => subject.ShouldBeEquivalentTo(expected); //----------------------------------------------------------------------------------------------------------- // Assert //----------------------------------------------------------------------------------------------------------- action.ShouldNotThrow(); }
public void When_an_interface_hierarchy_is_used_it_should_include_all_inherited_properties() { //----------------------------------------------------------------------------------------------------------- // Arrange //----------------------------------------------------------------------------------------------------------- ICar subject = new Car { VehicleId = 1, Wheels = 4 }; ICar expected = new Car { VehicleId = 99999, Wheels = 4 }; //----------------------------------------------------------------------------------------------------------- // Act //----------------------------------------------------------------------------------------------------------- Action action = () => subject.ShouldBeEquivalentTo(expected); //----------------------------------------------------------------------------------------------------------- // Assert //----------------------------------------------------------------------------------------------------------- action .ShouldThrow<AssertFailedException>() .WithMessage("Expected property VehicleId*99999*but*1*", ComparisonMode.Wildcard); }