The .NET Developer practicum is evaluated on:
- Object Oriented Design
- Readability
- Maintainability
- Testability
Technical Requirements:
- Create this solution as a console application
- Solution must have unit tests
- Solution must have a build script that can compile and test the solution from the command line
- Put your solution in a GitHub repository, and send us a link when done
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: morning, 1, 2, 3
Output: eggs, toast, coffee
Input: morning, 2, 1, 3
Output: eggs, toast, coffee
Input: morning, 1, 2, 3, 4
Output: eggs, toast, coffee, error
Input: morning, 1, 2, 3, 3, 3
Output: eggs, toast, coffee(x3)
Input: night, 1, 2, 3, 4
Output: steak, potato, wine, cake
Input: night, 1, 2, 2, 4
Output: steak, potato(x2), cake
This git repository contains a solution ('Gft.FoodMenu.sln' on root folder) for this Practicum. It contains the following projects:
Project | Description |
---|---|
Gft.FoodMenu.Client | Entrypoint to the executable. Simple console application. |
Gft.FoodMenu.Core | Class library that holds the core logic of the Practicum |
Gft.FoodMenu.Tests | Unit Tests Project, with 100% Code coverage of Gft.FoodMenu.Core |
The solution was designed to support additional custom menus by using MEF. All you have to do is:
- Create your Class Library
- Add Reference to(Gft.FoodMenu.Core.dll)
- Inherit from Gft.FoodMenu.Menus.BaseMenu Abstract Class
- Implement Name Property and GetDishOptions() method
- Add Reference to .NET Framework's MEF dll, System.ComponentModel.Composition.dll
- Decorate your custom Menu Class with the Export Attribute ([Export(typeof(IMenu))])
- Compile your Class Library
- COoy your class Library dll to a subfolder named "CustomMenus" within the same directory as the Gft.FoodMenu.Client.exe file. If this folder does not exists, you will have to create it.
SampleImplementation of a BaseMenu
[System.ComponentModel.Composition.Export(typeof(IMenu))]
public class AfternoonMenu : Gft.FoodMenu.Menus.BaseMenu
{
public override string Name
{
get
{
return "Afternoon";
}
}
protected override DishOption[] GetDishOptions()
{
return new[] {
new DishOption("Banana", DishTypes.entree),
new DishOption("bread", DishTypes.side),
new DishOption("Candy", DishTypes.dessert)
};
}
}
Powershell script
As requested, a Powershell Script that compiles and run all Unit Tests from Command Line is given(BuildAndRunTests.ps1 on same level as the solution(.sln) file). To call it just Open Visual Studio Command Prompt, go to the Solution Folder and Type this:
powershell -file .\BuildAndRunTests.ps1
The results will be within the BuildResults folder.
#Have fun...