Пример #1
0
        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.Should().BeEquivalentTo(c2);

            // Assert
            act.Should().NotThrow();
        }
Пример #2
0
        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.Should().BeEquivalentTo(c2);

            // Assert
            act.Should().Throw <XunitException>()
            .WithMessage("Expected property c1.RefOne.ValTwo to be 2, but found 3*");
        }