- Build application
- Go to
src\HotelsManager.CLI\bin\Debug\net8.0
- Run
dotnet HotelsManager.CLI.dll --hotels hotels.json --bookings bookings.json
You can also run directly from the IDE passing command arguments --hotels hotels.json --bookings bookings.json
.
The application is divided into the following layers:
- Domain Layer: Represents the core business concepts and primary computational logic.
- Application Layer: Responsible for orchestrating use cases.
- Infrastructure Layer: Handles communication with I/O (e.g., reading JSON files).
- Presentation Layer: Implements a Command Line Interface (CLI).
- JSON files are loaded dynamically each time they are accessed, which impacts performance.
- Alternatively, all files can be loaded into memory upfront, improving performance but requiring a restart of the application when files are updated (or implementation of data reload).
- No IoC container is used (a "vanilla DI" approach).
- No additional libraries like CliWrap are used for handling CLI commands.
Tests are implemented at multiple levels:
- Domain Level: Unit tests to verify core business logic.
- Infrastructure Level: Integration tests to verify JSON file handling.
- Integration Level: Tests validating the entire use case (application, domain, and infrastructure layers).
- End-to-End Tests: Not included due to the comprehensive coverage of lower-level tests, but they can be added if needed.
Several changes have been made to enhance user experience, such as:
- Adding
Help
andExit
commands. - Displaying appropriate messages when no availability instead of leaving empty output.
Performance-related topics, such as request rates or JSON file sizes, have not been addressed.
- Basic error handling has been implemented with certain assumptions (e.g., if files contain invalid data or format, an empty list is returned).
- This strategy is intentional and validated through tests, but alternative approaches could be adopted if needed.
Sample data (JSON files) have been prepared, and their presentation, which is important in the context of the algorithms, is included in the file SampleData.xlsx
.