Beispiel #1
0
            public void When_two_references_to_the_same_instance_are_not_equal_it_should_succeed()
            {
                // Arrange
                var subject = new SameInstanceIsNotEqualClass();
                var other   = subject;

                // Act
                Action act = () => subject.Should().NotBe(other);

                // Assert
                act.Should().NotThrow();
            }
Beispiel #2
0
            public void When_two_instances_are_the_same_reference_but_are_not_considered_equal_it_should_not_succeed()
            {
                // Arrange
                var subject = new SameInstanceIsNotEqualClass();
                var other   = subject;

                // Act
                Action act = () => subject.Should().Be(other, "they have the same property values");

                // Assert
                act
                .Should().Throw <XunitException>()
                .WithMessage(
                    "Expected*SameInstanceIsNotEqualClass*because they have the same property values, but found*SameInstanceIsNotEqualClass*.");
            }