public void IsInRange_WithValues_ReturnsExpected(IComparable value, IComparable lower, IComparable upper, BoundaryType type, bool expectedResult) { // act var result = value.IsInRange(lower, upper, type); // assert result.Should().Be(expectedResult); }
public void IsInRange_VariousUseCases_ReturnExpectedResult( IComparable sample, IComparable firstLimit, IComparable secondLimit, bool expectedResult) { // Call bool isSampleInRange = sample.IsInRange(firstLimit, secondLimit); // Assert Assert.AreEqual(expectedResult, isSampleInRange); }
public static void IsInRange() { IComparable <string> instance = null; string min = null; string max = null; var result = false; When("an extension is called", () => { Act(() => { result = instance.IsInRange(min, max); }); And("an instance is null", () => { instance = null; Should("return false", () => { Assert.That(result, Is.False); }); }); And("an instance is not null", () => { min = "111"; max = "222"; And("the instance is less than the minimum value", () => { instance = "101"; Should("return false", () => { Assert.That(result, Is.False); }); }); And("the instance is greater than the maximum value", () => { instance = "333"; Should("return false", () => { Assert.That(result, Is.False); }); }); And("the instance is equal to the minimum value", () => { instance = "111"; Should("return true", () => { Assert.That(result, Is.True); }); }); And("the instance is equal to the maximum value", () => { instance = "222"; Should("return true", () => { Assert.That(result, Is.True); }); }); And("the instance is between the minimum and maximum value", () => { instance = "121"; Should("return true", () => { Assert.That(result, Is.True); }); }); }); }); }