C# unit test, how to test greater than
In C# how can I unit test a greater than condition?
I.e., iIf record count is greater than 5 the test succeed.
Any help is appreciated
Code:
int actualcount = target.GetCompanyEmployees().Count
Assert. ?
Assert.IsTrue(actualCount > 5, "The actualCount was not greater than five");
It depends on which testing framework you're using.
For xUnit.net:
Assert.True(actualCount > 5, "Expected actualCount to be greater than 5.");
For NUnit:
Assert.Greater(actualCount, 5);
; however, the new syntax
Assert.That(actualCount, Is.GreaterThan(5));
is encouraged.
For MSTest:
Assert.IsTrue(actualCount > 5, "Expected actualCount to be greater than 5.");