Exemple #1
0
        public void When_two_instances_are_equal_it_should_succeed()
        {
            // Arrange
            var subject = new EquatableOfInt(1);
            var other   = new EquatableOfInt(1);

            // Act / Assert
            subject.Should().Be(other);
        }
Exemple #2
0
        public void When_two_unequal_objects_should_not_be_equal_it_should_not_throw()
        {
            // Arrange
            var subject = new EquatableOfInt(1);
            var other   = new EquatableOfInt(2);

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

            // Assert
            act.Should().NotThrow();
        }
Exemple #3
0
        public void When_two_equal_objects_should_not_be_equal_it_should_throw()
        {
            // Arrange
            var subject = new EquatableOfInt(1);
            var other   = new EquatableOfInt(1);

            // Act
            Action act = () => subject.Should().NotBe(other, "they represent different things");

            // Assert
            act
            .Should().Throw <XunitException>()
            .WithMessage(
                "*Did not expect subject to be equal to*1*because they represent different things.*");
        }
Exemple #4
0
        public void When_two_instances_are_not_equal_it_should_throw()
        {
            // Arrange
            var subject = new EquatableOfInt(1);
            var other   = new EquatableOfInt(2);

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

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