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

🧪 Add Test report #20

Closed
wants to merge 48 commits into from

Conversation

danielmackay
Copy link
Member

No description provided.

* Create new warehouse module

* Moved Warehouse.Application to Warehouse.Module

* Tidied up shared kernel

* Moved domain into Warehouse module

* Move Warehouse Endpoints into Warehouse Module

* Move Warehouse Endpoints to Warehouse Module

* Remove Order Application project

* Move Order Domain to Order Module

* Move Orders Endpoints to Orders Module
…20)

Tidied up modules so that only module registration code is public
* Update product catalog and add product creation tests

Adjusted README to remove redundant price requirement. Refactored the Product and Category classes for better encapsulation and added unit tests for product creation in the Catalog module.

* Add unit tests for Category creation in Catalog module

Introduce tests to ensure Category creation throws exceptions for null, empty, and whitespace names. Also, verify correct Category creation with valid name.

* Refactor out validation method calls.

Replaced custom validation methods with built-in `ArgumentOutOfRangeException.ThrowIfNegativeOrZero` for better clarity and consistency. Also adjusted loop indices to start from 1 instead of 0 in `Bay` and `Aisle` class methods.
Refactored the Cart and CartItem classes to include methods for adding, removing, and updating items, along with maintaining the total price. Modified the warehouse middleware initialization to be synchronous, and added unit tests for CartItem.
Introduced a read-only property for cart items and extended the `UpdateTotal()` method to handle empty carts. Additionally, created unit tests covering add, remove, and update operations to ensure cart functionality works as expected.

#28
Introduced new Payment and PaymentType classes to handle order payments. Updated the Order class with comprehensive methods for handling subtotals, shipping, and tax. Reorganized the directory structure for better modularity and clarity.

#28
Implemented detailed unit tests for LineItem, Payment, and Order classes to ensure correct behavior and error handling. Also, updated OrderStatus enum and enhanced payment creation logic for improved validation.

#28
Improved validation by replacing custom `Throw().IfEmpty()` calls with standard library methods like `ArgumentException.ThrowIfNullOrWhiteSpace()`. Added invariants for the `Customer` class and made email and name update methods private, ensuring encapsulation. Updated the README for clarity and consistency.

#27
Made `UpdateName` and `UpdateEmail` methods public to facilitate testing. Added various tests for customer creation, name update, email update, and address update scenarios. Included new AddressTests to validate address initialization and error handling.
Merged the tests from `AisleTests.cs` into `ModelTests.cs` and renamed it to `Storage/AisleTests.cs` for better organization. Deleted the old `AisleTests.cs` file to avoid duplication.
* ✨ Add custom Aisle configuration and update database setup

Refactor database seeding to include new Aisle configurations and custom storage command. Moving the database initializer to a new tools project enhances modularity and clarity in database seeding procedures. Additionally, some configurations in existing entities and properties have been updated accordingly.

* ✨ Add StronglyTypedId support to warehouse module

Introduced StronglyTypedId conversion and configuration in the warehouse module. Updated entity creation methods and DbContext to use StronglyTypedId. Enhanced entity configurations and added Product DbSet to WarehouseDbContext.

* ✨ Enable product seeding and remove commented-out code

Re-enabled the `SeedProductsAsync` method to allow seeding products in the database. Removed commented-out code for clarity and maintainability. Simplified the aisle seeding logic for better readability.
Added necessary dependencies and configurations for integration testing in the Warehouse module. Implemented a new integration test for creating aisles, ensuring correct behavior and database interactions.

#29
Added `ICurrentUserService` and `EntitySaveChangesInterceptor` to enhance audit logging in the persistence layer. Integrated these into the application by updating dependencies and ensuring proper initialization in DI setup.
Updated MediatR behaviors to include `ResultValidationBehavior`, replaced `ValidationBehaviour`, and integrated the ErrorOr package across the solution. Added new tests for invalid requests and refactored existing classes to support the ErrorOr type.

#29
Refactored the product creation logic and moved endpoint mappings from the Products module to a new UseCases module. Removed unused repository and command files. Improved validation and error handling for product creation.
Implement methods for adding and removing stock in the `Product` class, returning an error when attempting to remove more stock than available. Add unit tests to ensure proper functionality and error handling, ensuring product initialization and stock adjustments are covered.

#30
Introduce `ProductErrors` class to handle validation errors related to products. Also, implement integration tests to verify product creation and handle invalid requests properly.
Refactored endpoint mappings from command-based names to simpler class names. Removed old commented-out code and renamed CreateProductCommand and CreateAisleCommand to CreateProduct and CreateAisle respectively. Also added a new connection string for the Warehouse database in the development environment settings.
Renamed UseCases to follow the 'Command' naming convention for clarity. Added OpenApiExt for better Swagger configuration and moved Swagger setup into this extension in `Program.cs`.
Implemented `AllocateStorageCommand` to handle storage allocation requests.
Added integration and unit tests to ensure proper functionality and error handling.

#32
Removed redundant StorageAllocationServiceTests.cs and merged its contents into the existing Storage/StorageAllocationServiceTests.cs. This cleanup reduces duplication and improves file organization in test modules.

#32
Renamed `ErrorOrExt` and moved it to `Common.SharedKernel.Api`. Updated relevant files to reflect the new namespace and added necessary imports to accommodate the change.
Removed the GetProductsQuery.cs file and its associated query to streamline the codebase. Introduced GetItemLocationQuery.cs for fetching the location of specific items within the warehouse. Updated the solution file to reflect these changes.

#33
Relocated integration test files to the 'UseCases' subdirectory and domain service test files to the 'Domain' subdirectory for better organization. Updated namespaces and class names to reflect new folder structure, ensuring consistency and clarity in file organization.
Introduced the GetItemLocationQuery endpoint to the Warehouse module. Added integration tests to ensure it returns correct item locations, and modified the IntegrationTestBase to support saving changes asynchronously.
Replaced the `DomainEvent` class with an `IDomainEvent` interface, and added a new interceptor for dispatching domain events post-save. Updated the `AggregateRoot` class and related domain events to incorporate these changes. Added middleware for event handling and eventual consistency support.

#35
Added `ProductStoredIntegrationEvent` to handle product storage notifications between Warehouse and Products modules. Created corresponding event handlers in both modules to publish and process these events, ensuring proper logging and setup in the solution.

#35
Introduced the new Catalog module and integrated it into the WebApi project. Removed the deprecated MockCurrentUserServiceProvider. Made enhancements to event handling and domain interfaces.

#35
Introduce tests to verify the creation of bays and shelves, product assignment, and error handling when storage is full. This enhances the robustness of the storage allocation logic in the Aisle class.

#35
Removed redundant Category and Service files and renamed key configuration files for consistency. Introduced `DependencyInjection` in the `Catalog` module and updated database initialization to propagate products between `Warehouse` and `Catalog`. Simplified strongly-typed ID handling and made middleware generic.
Refactored the product configuration to handle many-to-many relationships. Introduced seeding for categories within the CatalogDbContextInitialiser using the Bogus library. Added a new method to seed categories and updated the product seeding to assign random categories.
Integrated CatalogDbContext into ProductStoredIntegrationEventHandler to save new products to the database. This change ensures that products are persistently stored upon handling the integration event.
Introduced a new test project, WebApi.Tests, to the solution to include integration tests. This project includes initial setup with xUnit and references necessary testing packages.
Moved common test utilities to a new `Common.Tests` project to enhance modularity and reuse. Adjusted references and namespaces accordingly, updated `WarehouseDbContext` visibility, and ensured all fixtures and base classes use generic types for flexibility.

#35
Added manual trigger and updated permissions in the workflow. Upgraded action versions and configured release builds and test logging. Added test result reporting for improved visibility.
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 this pull request may close these issues.

1 participant