This is a simple app with an API + Tests
Rules:
- You must enter time of day as “morning” or “night”
- You must enter a comma delimited list of dish types with at least one selection
- The output must print food in the following order: entrée, side, drink, dessert
- There is no dessert for morning meals
- Input is not case sensitive
- If invalid selection is encountered, display valid selections up to the error, then print error
- In the morning, you can order multiple cups of coffee
- At night, you can have multiple orders of potatoes
- Except for the above rules, you can only order 1 of each dish type
Dishes for Each time of day
Dish Type | morning | night |
---|---|---|
1 (entrée) | eggs | steak |
2 (side) | toast | potato |
3 (drink) | coffee | wine |
4 (dessert) | Not Applicable | cake |
Sample Input and Output
Input | Output |
---|---|
morning, 1, 2, 3 | eggs, toast, coffee |
morning, 2, 1, 3 | eggs, toast, coffee |
morning, 1, 2, 3, 4 | eggs, toast, coffee, error |
morning, 1, 2, 3, 3, 3 | eggs, toast, coffee(x3) |
night, 1, 2, 3, 4 | steak, potato, wine, cake |
night, 1, 2, 2, 4 | steak, potato(x2), cake |
night, 1, 2, 3, 5 | steak, potato, wine, error |
night, 1, 1, 2, 3, 5 | steak, error |
The API is temporarily available at this link: API Swagger Link
This project contains the Integration tests, and it is using xUnit + FluentAssertions. There is a trigger (PR to main branch) to run this test with Github Actions before publish it to Azure
This project contains the Web API project with .net Core 3.1. There is a trigger (PR to main branch) to publish it to Azure with Github Actions
This is a project with a simple console aplication that consumes the API. The URL of API is HardCoded inside RestaurantOrderService class at line 9