Skip to content

Commit

Permalink
Don't throw in tear down if test already failing
Browse files Browse the repository at this point in the history
  • Loading branch information
kayoub5 authored and chmorgan committed Mar 14, 2020
1 parent e416a44 commit 1141a2d
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Test/TestHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using System.Reflection;
using System.Threading;
using NUnit.Framework;
using NUnit.Framework.Interfaces;

namespace Test
{
Expand Down Expand Up @@ -113,9 +114,13 @@ internal static void ConfirmIdleState()
var isStarted = d.Started;
if (isStarted) d.StopCapture();
if (isOpened) d.Close();

Assert.IsFalse(isOpened, "Expected device to not to be Opened");
Assert.IsFalse(isStarted, "Expected device to not be Started");
var status = TestContext.CurrentContext.Result.Outcome.Status;
// If test already failed, no point asserting here
if (status != TestStatus.Failed)
{
Assert.IsFalse(isOpened, "Expected device to not to be Opened");
Assert.IsFalse(isStarted, "Expected device to not be Started");
}
}
}
}
Expand Down

0 comments on commit 1141a2d

Please sign in to comment.