jeudi 15 septembre 2016

Asserts in helper methods

I'm implementing some test cases in Visual Studio (TestTools). I have to reuse a common logic in some of them. So I decided to extract this logic into a helper method. It is good practice to call Assert.AreEqual (..) from these helper methods? For example:

[TestMethod]
public void myTest() 
{
    ...
    helperMethod();
    ...
}

public void helperMethod()
{
    ...
    Assert.AreEqual("x", str);
}

Aucun commentaire:

Enregistrer un commentaire