This project implements a parcel pricing and discount system for a delivery service.
-
Ensure you have .NET 7.0 SDK installed on your machine.
-
Clone this repository to your local machine.
-
Open a terminal and navigate to the project root directory.
-
Run the following command to execute all tests:
dotnet test
- Parcel sizes are determined solely by the largest dimension (length, width, or height).
- Weight limits are applied after determining the size category.
- The Heavy parcel category overrides any size-based categorization if the weight is 50kg or more.
- All monetary values are in a single currency with two decimal places of precision.
- All weights are in kilograms (kg) and represented as positive numbers.
- Dimensions (length, width, height) are in the same unit of measurement (e.g., centimeters).
- There is no maximum weight limit implemented (beyond what a double can represent).
- The minimum weight is assumed to be greater than 0 kg.
- We do not handle currency conversion or multi-currency support.
- Very small weight differences may be subject to floating-point precision limitations.
- The project uses a factory pattern to create parcels, orders, and calculators.
- Discount calculation is separated into its own class for better separation of concerns.
- Unit tests cover various scenarios for parcel cost calculation and discount application.
- Discount functionality is not currently implemented or tested.
- Implement more comprehensive error handling and input validation.
- Add integration tests to cover end-to-end scenarios.
- Improve the efficiency of discount calculations for large orders.
- Implement a user interface (console or web-based) for easier interaction with the system.
- Add logging for better debugging and monitoring.
- Consider using dependency injection for better testability and flexibility.
- The current implementation does not fully optimize for the best combination of discounts in all scenarios (Step 5f of the discount requirements).
- Edge cases with extremely large or heavy parcels may not be fully covered.
The project was developed with a series of well-structured commits, each focusing on a specific feature or improvement. You can view the commit history to see the progression of the implementation.
- The discount calculation logic could be optimized for better performance with large orders.
- More extensive documentation within the code would improve readability and maintainability.
- Some parts of the code, particularly in the
CostCalculator
class, could benefit from refactoring for better separation of concerns. - I noticed, in
CalculatorFactory
, the parameters forCreateParcel
are a bit too much and makes the code a bit harder to read, it could be simplified with passing a single model.
Despite these areas for improvement, the current implementation provides a solid foundation for the parcel service pricing system, with good test coverage and a clear structure.