nopara73
nopara73

Reputation: 512

xUnit: stop test execution from code

Can I finish the unit test from code? Is it possible to do something like this?

[Fact]
public void Test()
{
   code;
   code;
   code;
   StopUnitTest(success: true);
   code;
   code;
}

Upvotes: 0

Views: 1626

Answers (1)

n4nd0_o
n4nd0_o

Reputation: 2988

Not really sure why one would do that and I know it's maybe a bit too late to reply. However, the usage of goto keyword could potentially solve this.

Reference: https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/goto

Upvotes: 2

Related Questions