Conversation
…er small refactors to update the current code with the most recent language features.
Added CompatibilityLevel configuration to EF Core configuration for most recent features usages.
|
@matthewtoghill please check the latest changes out... I've replaced the Swashbuckle implementation for Swagger with Scalar and also included the document and operation transformers for the API security so everything can work pretty similar to how it was with Swashbuckle, but without all the custom code for fixing its issues. |
… block extension methods.
…auth flag is false as base property is also removed
Looks good, there was an old issue related to the auth flag being false that is now fixed, or it can be fixed another way if you prefer. When |
EntityTypeConfiguration now uses ValueGeneratedNever for IDs, shifting ID generation from the database to the application (via Guid.NewGuid()). Updated entity constructors, command handlers, and tests to align with this approach. Adjusted EF Core migrations and model snapshots to remove ValueGeneratedOnAdd. Cleaned up related test and factory code for consistency.
...nt/Backend/Solution/Monaco.Template.Backend.Common.Api/OpenApi/OAuth2OperationTransformer.cs
Outdated
Show resolved
Hide resolved
Refactored MediatorExtensions to support CancellationToken in all methods, improving async and cancellation handling. Introduced CreatedResponse record for standardized creation responses. Updated Companies, Products, and Files endpoints to use new Mediator methods and return Created<CreatedResponse>. Adjusted integration tests to validate CreatedResponse. Improved code clarity and authorization policy checks.
|
@matthewtoghill please review the latest changes I introduced. Lastly, please be kind to let me know if you find any issue when running the whole tests battery (including the Integration ones in the same process)... I experienced an issue with the CreateProduct one, where the assertion checking if the ProductCreated message has been consumed is failing, but when I run it individually it succeeds, so I'm not sure if it's my crappy laptop or what, so if you could run it and let me know, that would be great! Thanks! Cheers! |
- Use [Collection("IntegrationTests")] to share AppFixture across all test classes, starting containers only once per run
- Add Respawn for fast, reliable DB resets between tests
- Apply DB migrations once in fixture, not per test
- Remove redundant DbContext/migration logic from test base
- Disable test collection parallelization via xunit.runner.schema.json
- Update dependencies and project files for Respawn and config
- Simplify and clarify test setup/teardown for better reliability
CesarD
left a comment
There was a problem hiding this comment.
I have added a few fixes to Integration Tests and reconsidered @matthewtoghill 's proposal for implementing Spawner for resetting the DB between test classes. Now Integration Tests will share the same AppFixture so there won't be a constant regeneration of test containers between runs and as a consequence these tests have suffered a huge boost in execution speed.
I left out some considerations on the integration tests that I need to address
@CesarD - I get the same issue with the test, but this seems to be fixed when I revert the change to lines 334 and 339 from and
I've pushed this and some other fixes from my testing. I think we should be there for merging this PR now? |
…s as no longer needed
I actually found out the issue but haven't gotten the chance to finish applying the fix yet: |
Refactor and modernize integration test infrastructure: - Pin Testcontainers images for SQL Server, RabbitMQ, Azurite, Keycloak - Require IServiceProvider for DbContext resolution; update all usages - Move MassTransit test harness setup to extension methods - Add GetCustomFactory for flexible Web/Worker factory config - Remove direct IHost usage for worker; use DI instead - Use per-test FlurlClient with proper disposal - Improve resource cleanup in AppFixture.DisposeAsync - Use Parallel.ForEachAsync for blob cleanup in ProductsTests - Enhance MassTransit message assertions for content matching - General code cleanup and modernization for maintainability and test isolation
Ok @matthewtoghill, I have finally pushed the latest version with the fixes and refactors needed for the Integration Tests to work correctly. Now they have a bit better isolation and so the instantiation of a new instance of the WebAppFactory and the WorkerServiceFactory allow to register them with the Test Harness only when needed and use it only once so it doesn't get reused across different tests which is what was messing them up in the first place. BTW: sorry for the long wait, I had to sort some other things out and couldn't spare the time for this, but now it's finally done 😄 |
Description
Upgrade the solution to .NET 10.
AsQueryable()[FromFile]annotation on endpointIFormFileparameternameofRelated Issue
Closes #101
How Has This Been Tested?
Tests pass
Test apps created from template created successfully, build and run as expected
Types of changes
Checklist: