Shouldly
Search…
InRange
ShouldBeInRange is the inverse of ShouldNotBeInRange.

ShouldBeInRange

1
var homer = new Person { Name = "Homer", Salary = 300000000 };
2
homer.Salary.ShouldBeInRange(30000, 40000);
Copied!
Exception
1
homer.Salary
2
should be in range
3
{ from = 30000, to = 40000 }
4
but was
5
300000000
Copied!

ShouldNotBeInRange

1
var mrBurns = new Person { Name = "Mr. Burns", Salary = 30000 };
2
mrBurns.Salary.ShouldNotBeInRange(30000, 40000);
Copied!
Exception
1
mrBurns.Salary
2
should not be in range
3
{ from = 30000, to = 40000 }
4
but was
5
30000
Copied!
Last modified 1yr ago