-
Notifications
You must be signed in to change notification settings - Fork 177
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
Chore(Tests): CNX-8640 core integration test project #3130
Conversation
JR-Morgan
commented
Jan 10, 2024
•
edited
Loading
edited
- Resolved naming violations in Integration test projects
- Updated editor config to warn when using the old nunit functions
- Updated both Unit and integration tests to use the new nunit functions
- Removed ConfigureAwaits from test project:
- My reasoning is. They aren't needed, don't provide value, just adds visual clutter.
- Happy to discuss and revert if prefered.
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.
No complaints, just a question 👇🏼 Approving anyways
_client.MaybeThrowFromGraphQLErrors(new GraphQLRequest(), new GraphQLResponse<string>()); | ||
// We're just checking that the prev function didn't throw | ||
Assert.True(true); |
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.
Ohh WTH 🤣
@@ -33,7 +33,7 @@ public void Receive_OperationCanceled_ExceptionThrown(string id) | |||
ctc.Cancel(); | |||
|
|||
MemoryTransport emptyTransport2 = new(); | |||
Assert.ThrowsAsync<OperationCanceledException>(async () => | |||
Assert.CatchAsync<OperationCanceledException>(async () => |
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.
Is CatchAsync
the recommended pattern to assert an exception type here? Asking out of ignorance
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.
ThrowsAsync
tests if the method throws the EXACT type
CatchAsync
allows subtypes
In this case, the spirit of the test was to make sure it an OperationCancelledException
, we don't care if its a subtype like TaskCancelledException
, so I after learning of the existence of CatchAsync
, I decided to update the functions where we would be ok with subtypes.