Milestone 3 Requirements

Web Only

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

Warning

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

PropertyAccessorsTypeValue
Nameget onlystring"Flying Saucer"
Descriptionget onlystring"A stack of six pancakes, smothered in rich maple syrup, and topped with mixed berries and whipped cream."
Stack Sizeget and setuintDefault of 6, no more than 12
Syrupget and setboolDefaults to true
WhippedCreamget and setboolDefaults to true
Berriesget and setboolDefaults to true
Priceget onlydecimal$8.50, plus an additional $0.75 for each additional pancake beyond the default
Caloriesget onlyuint64 per pancake, plus 32 calories if syrup is included, 414 calories if whipped cream is included, and 89 calories if berries are included
SpecialInstructionsget onlyIEnumerable⟨string⟩Should include:
  • "[n] pancakes" with [n] being the number of pancakes when it is not the default 2
  • "Hold Butter" if Butter is false
  • "Hold Syrup" if Syrup is false

Crashed Saucer

PropertyAccessorsTypeValue
Nameget onlystring"Crashed Saucer"
Descriptionget onlystring"A stack of crispy french toast smothered in syrup and topped with a pat of butter."
Stack Sizeget and setuintDefault of 2, no more than 6
Syrupget and setboolDefaults to true
Butterget and setboolDefaults to true
Priceget onlydecimal$6.45, plus an additional $1.50 for each additional slice beyond the default
Caloriesget onlyuint149 per slice of french toast, plus 52 calories if syrup is included, and 35 calories if butter is included
SpecialInstructionsget onlyIEnumerable⟨string⟩Should include:
  • "[n] slices" with [n] being the number of slices when it is not the default 2
  • "Hold Butter" if Butter is false
  • "Hold Syrup" if Syrup is false

Livestock Mutilation

PropertyAccessorsTypeValue
Nameget onlystring"Livestock Mutilation"
Descriptionget onlystring"A hearty serving of biscuits, smothered in sausage-laden gravy."
Biscuitsget and setuintDefaults to 3, maximum of 8
Gravyget and setboolDefaults to true
Priceget onlydecimal$7.25 + $1.00 per biscuit beyond 3.
Caloriesget onlyuint49 per biscuit, plus 140 calories for gravy
SpecialInstructionsget onlyIEnumerable⟨string⟩Should include:
  • "[n] biscuits" with [n] being the number of biscuits when it is not the default 3
  • "Hold Gravy" if Gravy is false

Outer Omelette

PropertyAccessorsTypeValue
Nameget onlystring"Outer Omelette"
Descriptionget onlystring"A fully loaded Omelette."
CheddarCheeseget and setboolDefaults to true
Peppersget and setboolDefaults to true
Mushroomsget and setboolDefaults to true
Tomatoesget and setboolDefaults to true
Onionsget and setboolDefaults to true
Priceget onlydecimal$7.45
Caloriesget onlyuint94 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
SpecialInstructionsget onlyIEnumerable⟨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

PropertyAccessorsTypeValue
Nameget onlystring"Crop Circle"
Descriptionget onlystring"Oatmeal topped with mixed berries."
Berriesget and setboolDefaults to true
Priceget onlydecimal$2.00
Caloriesget onlyuint158 calories, plus 89 calories if berries are included
SpecialInstructionsget onlyIEnumerable⟨string⟩Includes "Hold Berries" if the Berries property is false.

Glowing Haystack

PropertyAccessorsTypeValue
Nameget onlystring"Glowing Haystack"
Descriptionget onlystring"Hash browns smothered in green chile sauce, sour cream, and topped with tomatoes."
Green Chile Sauceget and setboolDefaults to true
Sour Creamget and setboolDefaults to true
Tomatoesget and setboolDefaults to true
Priceget onlydecimal$2.00
Caloriesget onlyuint470 calories, plus 15 calories for green chile sauce, 23 calories for sour cream, and 22 calories for tomatoes
SpecialInstructionsget onlyIEnumerable⟨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

PropertyAccessorsTypeValue
Nameget onlystring"Taken Bacon"
Descriptionget onlystring"Crispy strips of bacon."
Countget and setuintDefaults to 2 strips of bacon, must be a value between 1 and 6
Priceget onlydecimal$1.00 per strip of bacon
Caloriesget onlyuint43 calories per strip of bacon
SpecialInstructionsget onlyIEnumerable⟨string⟩For any number of strips but two, should include "[n] strips" where [n] is the count.
PropertyAccessorsTypeValue
Nameget onlystring"Missing Links"
Descriptionget onlystringSizzling pork sausage links."
Countget and setuintDefaults to 2 sausage links, must be a value between 1 and 8
Priceget onlydecimal$1.00 per sausage link
Caloriesget onlyuint391 calories per link of sausage
SpecialInstructionsget onlyIEnumerable⟨string⟩For any number of links but two, should include "[n] links" where [n] is the count.

Eviscerated Eggs

PropertyAccessorsTypeValue
Nameget onlystring"Eviscerated Eggs"
Descriptionget onlystring"Eggs prepared the way you like."
Styleget and setEggStyleDefaults to over easy
Countget and setuintDefaults to 2 eggs, must be a value between 1 and 6
Priceget onlydecimal$1.00 per egg
Caloriesget onlyuint78 calories per egg
SpecialInstructionsget onlyIEnumerable⟨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

PropertyAccessorsTypeValue
Nameget onlystring"You're Toast"
Descriptionget onlystring"Texas toast."
Countget and setuintDefaults to 2 slices of toast, must be a value between 1 and 12
Priceget onlydecimal$1.00 per slice of toast
Caloriesget onlyuint100 calories per slice of toast
SpecialInstructionsget onlyIEnumerable⟨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?

Warning

Projects that do not compile will receive an automatic grade of 0.

Subsections of Milestone 3 Requirements

Subsections of Previous Versions

Milestone 3 Requirements (Spring 2022)

Web Only

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 Fall 2022 offering of that course. If you are not enrolled in the course, please disregard this section.

For this milestone, you will be creating some additional menu item classes and refactoring others. This will involve refactoring some already written classes, as well as adding some new ones.

General requirements:

Assignment requirements:

You will need to:

  • Create a base class for Poppers
  • Refactor existing popper classes to use inheritance
  • Create an interface for menu items, IMenuItem
  • Implement IMenuItem on all menu items
  • Create platter classes representing specific platters:
    • Piper Platter
    • Popper Platter
  • Create a UML diagram representing all the classes, enums, and interfaces in your Data project.

Purpose:

This milestone serves to introduce and utilize aspects of polymorphism including base classes, abstract base classes, abstract methods, virtual methods, method overriding, and interfaces. While the actual programming involved is straightforward, the concepts involved can be challenging to master. If you have any confusion after you have read the entire assignment please do not hesitate to reach out to a Professor Bean, the TAs, or your classmates over Discord.

Recommendations:

  • Get in the habit of reading the entire assignment before you start to code. Make sure you understand what is being asked of you. Please do not get ahead of yourself and have to redo work because you did not read the entire assignment.

  • Accuracy is important. Your class, property, enumeration and other names, along with the descriptions must match the specification given here. Otherwise, your code is not correct. While typos may be a small issue in writing intended for human consumption, in computer code it is a big problem!

  • Remember that you must document your classes. This was covered in prior courses and also discussed in chapter 3 of your textbook.

  • The KSU.CS.CodeAnalyzers NuGet package installed in your project will automatically flag issues for naming and commenting conventions in your code with warnings. Be sure to address these!

Popper Base Class

You will need to create an abstract base class Popper in the File Popper.cs in the FriedPiper.Data.MenuItems namespace to represent the properties common to all popper menu items (Apple Fritters, Fried Bananas, Fried Cheesecake, and Fried Oreos). The different inheritance modifiers you might want to use are:

  • virtual when you want to provide an implementation in the base class that can be overridden in derived class,
  • abstract when all derived classes need to provide their own implementation, and
  • a regular method (not virtual or abstract) when all derived classes can use the base property without overriding it.

Refactoring Poppers

Refactor the popper classes (AppleFritters, FriedBananas, FriedCheeseCake, and FriedOreos) to inherit from the Popper base class. You should be able to remove properties from these classes that are now provided by the base class.

IMenuItem Interface

You will need to declare an interface IMenuItem representing the common aspects of all menu items in the file IMenuItem.cs in the FriedPiper.Data.MenuItems namespace. The properties included in this interface should be:

  • Name - a get-only string
  • Price - a get-only decimal
  • Calories - a get-only uint

Implementing IMenuItem

Every menu item class should be refactored to implement the IMenuItem interface (i.e. (FriedPie, FriedIceCream, FriedCandyBar, FriedTwinkie, AppleFritters, FriedBananas, FriedCheeseCake, FriedOreos, and the new platter classes described below).

Platter Classes

A platter represents a combination of existing menu items that when ordered together come at a discounted price and are ideal for sharing. Thus, they need a properties to hold the menu items they consist of. All platter classes should also implement the IMenuItem interface.

Piper Platter

A Piper Platter is a platter consisting of two fried pies and two fried ice creams. These can be any combination of flavors. The class should be named PiperPlatter, defined in the file PiperPlatter.cs and defined in the FriedPiper.MenuItem namespace. It should have the following properties:

  • Name - a get-only string that is always “Piper Platter”
  • LeftPie - a FriedPie instance representing the first fried pie
  • RightPie - a FriedPie instance representing the second fried pie
  • LeftIceCream - a FriedIceCream instance representing the first fried ice cream
  • RightIceCream - a FriedIceCream instance representing the second fried ice cream
  • Calories - a get-only uint that should be the sum of calories for all fried pies and ice creams in the platter
  • Price - a get-only decimal with a value of $12.00.

Note that the LeftPie, RightPie, LeftIceCream, and RightIceCream must be initialized (not be null) when the class is first constructed. You can pick the default instances for each.

Popper Platter

A Popper Platter is a platter consisting of one of each of the four popper items AppleFritters, FriedBananas, FriedCheeseCake, and FriedOreos), an ideal treat for the indecisive. The class should be named PopperPlatter, defined in the file PopperPlatter.cs and defined in the FriedPiper.MenuItem namespace. It should have the following properties:

  • Name - a get-only string that is “[size] Popper Platter”, where [size] is the Size property of the platter
  • Size - a ServingSize property representing the size of the poppers in the order. It should default to Small. All poppers in the platter should be the same size, so changing it should also change the size of each of the poppers to match.
  • Glazed - a boolean property (defaulting to true) indicating if the poppers are glazed or not. As the platter is glazed as a whole, all poppers on platter are either glazed or not glazed. Thus, changing the Glazed property should change the corresponding property of each of the poppers to match.
  • AppleFritters - a get-only AppleFritters instance representing the apple fritters in the platter
  • FriedBananas - a get-only FriedBananas instance representing the fried bananas in the platter
  • FriedCheesecake - a get-only FriedCheesecake instance representing the fried cheesecake in the platter
  • FriedOreos - a get-only FriedOreos instance representing the fried Oreos in the platter
  • Calories - a get-only uint that should be the sum of calories for all the poppers in the platter
  • Price - a get-only decimal with a value of $12.00 for small, $16.00 for medium, and $20.00 for large.

Note that the popper properties must be initialized (not be null) when the class is first constructed, and each should start as Small.

UML Diagram

You will also need to create a UML diagram to represent each of the classes, enumerations, and interfaces defined in your Data project. You will need to include a copy of this diagram as a PDF or image file in a Documentation folder in your project.

In your UML diagram, be sure you represent the relationships between your classes correctly, i.e. generalization for inheritance, realization for interface implementation, and aggregation or composition for classes that hold instances of other classes. Review the chapter on UML if you are hazy on the distinction.

Carefully read the adding documentation discussion to ensure you are not adding a link to the file rather than the actual file to your project. You can also check the contents of your GitHub repository after you commit to make sure you included your documentation correctly.

If you use Visio to create your UML, it is also a good idea to place your Visio file in the Documentation folder, so you can always have access to it when you work on your project, as you will need to update it as you make changes.

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?

Warning

Projects that do not compile will receive an automatic grade of 0.