-
Notifications
You must be signed in to change notification settings - Fork 731
Redundant AggregateException removal #1038
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
Redundant AggregateException removal #1038
Conversation
|
I agree that it is better to I'm a bit suspicious/worried that we need to alter a test, that means the behavior has changed.
|
|
I agree with your concern. In general, I think we should unwrap an |
|
I've added another passing unit test to make sure we can check for an exception type when an AggregateException contains an instance of it: [Fact]
public void When_async_method_throws_aggregate_exception_containing_expected_exception_it_should_succeed()
{
//-----------------------------------------------------------------------------------------------------------
// Arrange
//-----------------------------------------------------------------------------------------------------------
Func<Task> task = async () =>
{
await Task.Delay(100);
throw new AggregateException(new InvalidOperationException());
};
//-----------------------------------------------------------------------------------------------------------
// Act
//-----------------------------------------------------------------------------------------------------------
Action action = () => task
.Should().Throw<InvalidOperationException>();
//-----------------------------------------------------------------------------------------------------------
// Assert
//-----------------------------------------------------------------------------------------------------------
action.Should().NotThrow();
}The latest build fails due to one of those flaky tests again. Aside from adding this test case, are there any other changes I should make at this stage? Thanks very much |
jnyrup
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha, I wasn't aware of the AggregateException unwrapping feature of FA.
Then it looks good to me 👍
It also inspired me to find some cases, where we wasn't consistent for NotThrow<TException> (PR coming up af this is merged)
Resolves issue #1037