I would like to have my TearDown method check whether the previous test was a success before it applies some logic. Is there an easy way to do this?
I would like to have my TearDown method check whether the previous test was a success before it applies some logic. Is there an easy way to do this?
[OneTimeTearDown]
public void AfterEachTest()
{
if (TestContext.CurrentContext.Result.Outcome.Status.Equals(TestStatus.Failed))
{
Console.WriteLine("FAILS");
}
else if (TestContext.CurrentContext.Result.Outcome.Equals(ResultState.Success))
{
Console.WriteLine("SUCESS");
}
}