mercredi 24 avril 2019

Using NUnit Multiple Assert when Assert statements are in different methods

I am running automated BDD steps using NUnit assertions for each step i.e. Then And.

The NUnit assertions are confined to confined to each method. This means that if an assertion in a method fails, then the other steps won't be run.

I was thinking of using NUnit Multiple Assert but this requires all the asserts to be together. Any ideas?

// Then Step
private void ThenIAmShownResultsFor(string expectedResults)
{
    Assert.AreEqual(expectedResults, actual);
}

// And Step
private void AndThePageCountIs(int expectedResults)
{
    Assert.AreEqual(expectedResults, actual);
}

Aucun commentaire:

Enregistrer un commentaire