-
Notifications
You must be signed in to change notification settings - Fork 0
chore: migrate test assertions from Shouldly to AwesomeAssertions v9.2.1 #2
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: migrate test assertions from Shouldly to AwesomeAssertions v9.2.1 #2
Conversation
Co-authored-by: JohnCampionJr <1094820+JohnCampionJr@users.noreply.github.com>
|
@copilot Exceptions test do not work. Use this pattern: |
|
@copilot I fixed the build errors so you should be able to run tests now |
Changed async exception tests to use synchronous pattern as requested: - Removed async keyword from test method signatures - Changed await ThrowAsync pattern to synchronous act.Should().Throw() - Replaced await calls with direct object instantiation where needed - Fixed duplicate variable names in tests with multiple assertions Co-authored-by: JohnCampionJr <1094820+JohnCampionJr@users.noreply.github.com>
... Fixed in d2eb22e. Exception tests now use the synchronous pattern: var act = () =>
{
var _ = store.FindByEmailAsync(null);
};
act.Should().Throw<ArgumentNullException>();All 19 test files with exception tests have been updated to:
|
|
@copilot correction, for async exceptions tests, use this pattern: |
Fixed compilation errors where Task methods were not returning a value. All exception test methods now properly return Task.CompletedTask. Co-authored-by: JohnCampionJr <1094820+JohnCampionJr@users.noreply.github.com>
Fixed in 0c26737. All exception test methods now properly return The migration is now complete with all tests using AwesomeAssertions v9.2.1 and the synchronous exception test pattern. |
Changed all exception tests to use async lambdas with await and ThrowAsync: - Method signatures changed from 'public Task' to 'public async Task' - Lambdas changed from synchronous to async with await - Changed .Throw() to .ThrowAsync() - Added await before assertions - Removed return Task.CompletedTask statements Co-authored-by: JohnCampionJr <1094820+JohnCampionJr@users.noreply.github.com>
... Fixed in 4e9a765. All exception tests now use the async pattern as requested: var act = async () =>
{
await store.AddClaimsAsync(null, new[] { new Claim("type", "value") });
};
await act.Should().ThrowAsync<ArgumentNullException>();All 19 test files have been updated with:
Build succeeds with no errors. |
using Shouldly;withusing AwesomeAssertions;in all test files (29 files)var act = async () => { await method(); }; await act.Should().ThrowAsync<T>()Action action = () => ...; action.Should().Throw<T>()Summary:
Successfully migrated all Shouldly assertions in the testing project to AwesomeAssertions v9.2.1. Exception tests for async methods have been updated to use async lambdas with
awaitandThrowAsync(). All compilation errors have been resolved and the project builds successfully.Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.