Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latest versions don't work with multiple ThrowsExactly in Assert.Multiple #1345

Closed
Patrick8639 opened this issue Dec 3, 2024 · 2 comments · Fixed by #1356
Closed

Latest versions don't work with multiple ThrowsExactly in Assert.Multiple #1345

Patrick8639 opened this issue Dec 3, 2024 · 2 comments · Fixed by #1356

Comments

@Patrick8639
Copy link

To reproduce:

  [Test]
  public async Task TestException ()
  {
    using (Assert.Multiple ())
    {
      await Assert.That (
        static () => throw new InvalidOperationException ()
      ).ThrowsExactly <InvalidOperationException> ();
      await Assert.That (
        static () => throw new InvalidOperationException ()
      ).ThrowsExactly <InvalidOperationException> ();
    }
  }

In TUnit 0.4.49, the test is successful.

In later versions, the following error is thrown:

One or more errors occurred. ((This exception may or may not have been caught) System.InvalidOperationException: Hello World) ((This exception may or ...

One or more errors occurred. ((This exception may or may not have been caught) System.InvalidOperationException: Hello World) >((This exception may or may not have been caught) System.InvalidOperationException: Hello World)
at TUnit.Assertions.AssertionScope.Dispose()
at TestException() in xxx
at TestException()
at TUnit.Core.AsyncConvert.Convert(Func1 action) at TUnit.Core.DiscoveredTest1.ExecuteTest(CancellationToken cancellationToken)
at TUnit.Engine.Helpers.Timings.Record(String name, TestContext context, Func1 action) at TUnit.Engine.Services.TestInvoker.Invoke(DiscoveredTest discoveredTest, CancellationToken cancellationToken, List1 cleanupExceptions)
at TUnit.Engine.Services.TestInvoker.Invoke(DiscoveredTest discoveredTest, CancellationToken cancellationToken, List1 cleanupExceptions) at TUnit.Engine.Services.SingleTestExecutor.ExecuteTestMethodWithTimeout(DiscoveredTest discoveredTest, CancellationToken cancellationToken, List1 cleanupExceptions)
at TUnit.Engine.Services.SingleTestExecutor.ExecuteWithCancellationTokens(DiscoveredTest discoveredTest, List1 cleanupExceptions) at TUnit.Engine.Services.SingleTestExecutor.ExecuteWithRetries(DiscoveredTest discoveredTest, List1 cleanupExceptions)
at TUnit.Engine.Services.SingleTestExecutor.ExecuteWithRetries(DiscoveredTest discoveredTest, List`1 cleanupExceptions)
at TUnit.Engine.Services.SingleTestExecutor.ExecuteTestInternalAsync(DiscoveredTest test, ITestExecutionFilter filter, ExecuteRequestContext context, Boolean isStartedAsDependencyForAnotherTest)
at TUnit.Engine.Services.SingleTestExecutor.ExecuteTestInternalAsync(DiscoveredTest test, ITestExecutionFilter filter, ExecuteRequestContext context, Boolean isStartedAsDependencyForAnotherTest)
at TUnit.Engine.Services.SingleTestExecutor.ExecuteTestInternalAsync(DiscoveredTest test, ITestExecutionFilter filter, ExecuteRequestContext context, Boolean isStartedAsDependencyForAnotherTest)
at TUnit.Engine.Services.TestsExecutor.ProcessTest(DiscoveredTest test, ITestExecutionFilter filter, ExecuteRequestContext context, CancellationToken cancellationToken)

@thomhurst thomhurst linked a pull request Dec 4, 2024 that will close this issue
@thomhurst
Copy link
Owner

Thanks for the report! Should be fixed in v0.4.71

@Patrick8639
Copy link
Author

@thomhurst Thank you Tom, it's working now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants