Skip to content

Gendarme.Rules.NUnit.ProvideMessageOnAssertCallsRule(2.10)

Sebastien Pouliot edited this page Jan 22, 2011 · 2 revisions

ProvideMessageOnAssertCallsRule

Assembly: Gendarme.Rules.NUnit
Version: 2.10

Description

This rule checks that all Assert.* methods are calling with 'message' parameter, which helps to easily identify failing test.

Examples

Bad example:

[Test]
public void TestThings ()
{
    Assert.AreEqual(10, 20);
    Assert.AreEqual(30, 40);
}

Good example:

[Test]
public void TestThings ()
{
    Assert.AreEqual(10, 20, "10 equal to 20 test");
    Assert.AreEqual(30, 40, "30 equal to 40 test");
    

Notes

  • This rule will not report any problems if only one Assert.* call was made inside a method, because it's easy to identify failing test in this case.
Clone this wiki locally