public void When_asserting_an_instance_to_not_be_in_a_certain_range_but_it_is_not_it_should_throw() { // Arrange var subject = new ComparableOfInt(1); // Act Action action = () => subject.Should().NotBeInRange(new ComparableOfInt(1), new ComparableOfInt(2)); // Assert action.Should().Throw <XunitException>(); }
public void When_assertion_an_instance_to_not_be_in_a_certain_range_and_it_is_not__it_should_succeed() { // Arrange var subject = new ComparableOfInt(3); // Act Action action = () => subject.Should().NotBeInRange(new ComparableOfInt(1), new ComparableOfInt(2)); // Assert action.Should().NotThrow(); }
public void When_assertion_an_instance_to_not_be_in_a_certain_range_but_it_is_not_it_should_throw() { // Arrange var subject = new ComparableOfInt(2); // Act Action action = () => subject.Should().NotBeInRange(new ComparableOfInt(1), new ComparableOfInt(2)); // Assert action.Should().Throw <XunitException>() .WithMessage("Expected subject to not be between*and*, but found *."); }
public void When_assertion_an_instance_to_be_in_a_certain_range_and_it_is_it_should_succeed() { //----------------------------------------------------------------------------------------------------------- // Arrange //----------------------------------------------------------------------------------------------------------- var subject = new ComparableOfInt(1); //----------------------------------------------------------------------------------------------------------- // Act //----------------------------------------------------------------------------------------------------------- Action action = () => subject.Should().BeInRange(new ComparableOfInt(1), new ComparableOfInt(2)); //----------------------------------------------------------------------------------------------------------- // Assert //----------------------------------------------------------------------------------------------------------- action.ShouldNotThrow(); }
public void When_assertion_an_instance_to_be_in_a_certain_range_but_it_is_not_it_should_throw() { //----------------------------------------------------------------------------------------------------------- // Arrange //----------------------------------------------------------------------------------------------------------- var subject = new ComparableOfInt(3); //----------------------------------------------------------------------------------------------------------- // Act //----------------------------------------------------------------------------------------------------------- Action action = () => subject.Should().BeInRange(new ComparableOfInt(1), new ComparableOfInt(2)); //----------------------------------------------------------------------------------------------------------- // Assert //----------------------------------------------------------------------------------------------------------- action.ShouldThrow <AssertFailedException>() .WithMessage( "Expected object to be between*and*, but found *."); }