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.");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With