This textbook was authored for the CIS 400 - Object-Oriented Design, Implementation, and Testing course at Kansas State University. This section describes assignments specific to the Spring 2023 offering of that course. Prior semester offerings can be found here. If you are not enrolled in the course, please disregard this section.
For this milestone, you will be creating tests for the menu items you’ve written in previous milestones.
General requirements:
You need to follow the style laid out in the C# Coding Conventions
You need to document your code using XML-style comments, with a minimum of
<summary>
tags, plus<param>
,<returns>
, and<exception>
as appropriate.
Assignment requirements:
You will need to create unit test classes for:
FlyingSaucer
CrashedSaucer
LivestockMutilation
OuterOmelette
CropCircle
GlowingHaystack
TakenBacon
MissingLinks
EvisceratedEggs
YoureToast
Purpose:
This milestone serves to practice writing tests utilizing the XUnit testing framework. If you have any confusion after you have read the entire assignment please do not hesitate to reach out to Professor Bean, the TAs, or your classmates over Discord.
Unit Test Classes
For each class in your Data
project, add a corresponding unit test class in the Test
project. These should use the same name as the Data
class, with UnitTest
appended, i.e. the unit tests for the FlyingSaucer
class are found in the FlyingSaucerUnitTests
class.
Each unit test class should include fact or theory tests to verify:
- The default starting value of every property
- That constraints specified on the values of properties are adhered to
- The expected value of every derived property based on possible state combinations for the object. If more than eight possibilities exist, at least eight must be specified by your
[InlineData]
All of your tests should pass - if they do not, check to make sure your code being tested is correct, and also that your test is well-written.
To serve as a guide, the full unit tests for FlyingSaucer
can be found in the FlyingSaucerUnitTest
class in the Test project.
The expected value tables from the earlier milestones are reprinted below
A few of the properties have been updated with new expectations. These are highlighted in yellow to make it easy to find. You will need to refactor (modify) your classes to match.
Flying Saucer
Property | Accessors | Type | Value |
---|---|---|---|
Name | get only | string | "Flying Saucer" |
Description | get only | string | "A stack of six pancakes, smothered in rich maple syrup, and topped with mixed berries and whipped cream." |
Stack Size | get and set | uint | Default of 6, no more than 12 |
Syrup | get and set | bool | Defaults to true |
WhippedCream | get and set | bool | Defaults to true |
Berries | get and set | bool | Defaults to true |
Price | get only | decimal | $8.50, plus an additional $0.75 for each additional pancake beyond the default |
Calories | get only | uint | 64 per pancake, plus 32 calories if syrup is included, 414 calories if whipped cream is included, and 89 calories if berries are included |
SpecialInstructions | get only | IEnumerable〈string〉 | Should include:
|
Crashed Saucer
Property | Accessors | Type | Value |
---|---|---|---|
Name | get only | string | "Crashed Saucer" |
Description | get only | string | "A stack of crispy french toast smothered in syrup and topped with a pat of butter." |
Stack Size | get and set | uint | Default of 2, no more than 6 |
Syrup | get and set | bool | Defaults to true |
Butter | get and set | bool | Defaults to true |
Price | get only | decimal | $6.45, plus an additional $1.50 for each additional slice beyond the default |
Calories | get only | uint | 149 per slice of french toast, plus 52 calories if syrup is included, and 35 calories if butter is included |
SpecialInstructions | get only | IEnumerable〈string〉 | Should include:
|
Livestock Mutilation
Property | Accessors | Type | Value |
---|---|---|---|
Name | get only | string | "Livestock Mutilation" |
Description | get only | string | "A hearty serving of biscuits, smothered in sausage-laden gravy." |
Biscuits | get and set | uint | Defaults to 3, maximum of 8 |
Gravy | get and set | bool | Defaults to true |
Price | get only | decimal | $7.25 + $1.00 per biscuit beyond 3. |
Calories | get only | uint | 49 per biscuit, plus 140 calories for gravy |
SpecialInstructions | get only | IEnumerable〈string〉 | Should include:
|
Outer Omelette
Property | Accessors | Type | Value |
---|---|---|---|
Name | get only | string | "Outer Omelette" |
Description | get only | string | "A fully loaded Omelette." |
CheddarCheese | get and set | bool | Defaults to true |
Peppers | get and set | bool | Defaults to true |
Mushrooms | get and set | bool | Defaults to true |
Tomatoes | get and set | bool | Defaults to true |
Onions | get and set | bool | Defaults to true |
Price | get only | decimal | $7.45 |
Calories | get only | uint | 94 for the eggs in the omelette, plus 113 calories for cheddar cheese, 24 calories for peppers, 4 calories for mushrooms, 22 calories for tomatoes, and 22 calories for onions |
SpecialInstructions | get only | IEnumerable〈string〉 | For any ingredient not used, should include "Hold [ingredient]" where [ingredient] is the name of the ingredient, i.e. if the CheddarCheese property is false, it should include "Hold Cheddar Cheese" |
Crop Circle
Property | Accessors | Type | Value |
---|---|---|---|
Name | get only | string | "Crop Circle" |
Description | get only | string | "Oatmeal topped with mixed berries." |
Berries | get and set | bool | Defaults to true |
Price | get only | decimal | $2.00 |
Calories | get only | uint | 158 calories, plus 89 calories if berries are included |
SpecialInstructions | get only | IEnumerable〈string〉 | Includes "Hold Berries" if the Berries property is false. |
Glowing Haystack
Property | Accessors | Type | Value |
---|---|---|---|
Name | get only | string | "Glowing Haystack" |
Description | get only | string | "Hash browns smothered in green chile sauce, sour cream, and topped with tomatoes." |
Green Chile Sauce | get and set | bool | Defaults to true |
Sour Cream | get and set | bool | Defaults to true |
Tomatoes | get and set | bool | Defaults to true |
Price | get only | decimal | $2.00 |
Calories | get only | uint | 470 calories, plus 15 calories for green chile sauce, 23 calories for sour cream, and 22 calories for tomatoes |
SpecialInstructions | get only | IEnumerable〈string〉 | For any ingredient not used, should include "Hold [ingredient]" where [ingredient] is the name of the ingredient, i.e. if the GreenChileSauce property is false, it should include "Hold Green Chile Sauce" |
Taken Bacon
Property | Accessors | Type | Value |
---|---|---|---|
Name | get only | string | "Taken Bacon" |
Description | get only | string | "Crispy strips of bacon." |
Count | get and set | uint | Defaults to 2 strips of bacon, must be a value between 1 and 6 |
Price | get only | decimal | $1.00 per strip of bacon |
Calories | get only | uint | 43 calories per strip of bacon |
SpecialInstructions | get only | IEnumerable〈string〉 | For any number of strips but two, should include "[n] strips" where [n] is the count. |
Missing Links
Property | Accessors | Type | Value |
---|---|---|---|
Name | get only | string | "Missing Links" |
Description | get only | string | Sizzling pork sausage links." |
Count | get and set | uint | Defaults to 2 sausage links, must be a value between 1 and 8 |
Price | get only | decimal | $1.00 per sausage link |
Calories | get only | uint | 391 calories per link of sausage |
SpecialInstructions | get only | IEnumerable〈string〉 | For any number of links but two, should include "[n] links" where [n] is the count. |
Eviscerated Eggs
Property | Accessors | Type | Value |
---|---|---|---|
Name | get only | string | "Eviscerated Eggs" |
Description | get only | string | "Eggs prepared the way you like." |
Style | get and set | EggStyle | Defaults to over easy |
Count | get and set | uint | Defaults to 2 eggs, must be a value between 1 and 6 |
Price | get only | decimal | $1.00 per egg |
Calories | get only | uint | 78 calories per egg |
SpecialInstructions | get only | IEnumerable〈string〉 | Should always contain a string corresponding to the Style property, i.e. if the Style property is EggStyle.OverEasy it should contain the string "Over Easy". If any number of eggs other than 2 is chosen, it should also contain "[n] eggs" where [n] is the number of eggs. |
You’re Toast
Property | Accessors | Type | Value |
---|---|---|---|
Name | get only | string | "You're Toast" |
Description | get only | string | "Texas toast." |
Count | get and set | uint | Defaults to 2 slices of toast, must be a value between 1 and 12 |
Price | get only | decimal | $1.00 per slice of toast |
Calories | get only | uint | 100 calories per slice of toast |
SpecialInstructions | get only | IEnumerable〈string〉 | For any number of slices but two, should include "[n] slices" where [n] is the count. |
Submitting the Assignment
Once your project is complete, merge your feature branch back into the main
branch and create a release tagged v0.3.0
with name "Milestone 3"
. Copy the URL for the release page and submit it to the Canvas assignment.
Grading Rubric
The grading rubric for this assignment will be:
25% Structure Did you implement the structure as laid out in the specification? Are the correct names used for classes, enums, properties, methods, events, etc? Do classes inherit from expected base classes?
25% Documentation Does every class, method, property, and field use the correct XML-style documentation? Does every XML comment tag contain explanatory text?
25% Design Are you appropriately using C# to create reasonably efficient, secure, and usable software? Does your code contain bugs that will cause issues at runtime?
25% Functionality Does the program do what the assignment asks? Do properties return the expected values? Do methods perform the expected actions?
Projects that do not compile will receive an automatic grade of 0.