Shouldly
Search…
Greater/Less Than
ShouldBeGreaterThan is the inverse of ShouldBeLessThan.

ShouldBeGreaterThan

1
var mrBurns = new Person { Name = "Mr. Burns", Salary = 30000 };
2
mrBurns.Salary.ShouldBeGreaterThan(300000000);
Copied!
Exception
1
mrBurns.Salary
2
should be greater than
3
300000000
4
but was
5
30000
Copied!

ShouldBeGreaterThanOrEqualTo

1
var mrBurns = new Person { Name = "Mr. Burns", Salary = 299999999 };
2
mrBurns.Salary.ShouldBeGreaterThanOrEqualTo(300000000);
Copied!
Exception
1
mrBurns.Salary
2
should be greater than or equal to
3
300000000
4
but was
5
299999999
Copied!

ShouldBeLessThan

1
var homer = new Person { Name = "Homer", Salary = 300000000 };
2
homer.Salary.ShouldBeLessThan(30000);
Copied!
Exception
1
homer.Salary
2
should be less than
3
30000
4
but was
5
300000000
Copied!

ShouldBeLessThanOrEqualTo

1
var homer = new Person { Name = "Homer", Salary = 30001 };
2
homer.Salary.ShouldBeLessThanOrEqualTo(30000);
Copied!
Exception
1
homer.Salary
2
should be less than or equal to
3
30000
4
but was
5
30001
Copied!
Last modified 1yr ago