Milestone 9 Requirements (Spring 2022)
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.
You will need to follow the style laid out in the C# Coding Conventions
You will need to comment your code using XML comments
You will need to update your UML to reflect your current code
You will need to write appropriate unit tests for your code
Create a new ASP.NET Core Web project named Website using the Razor Pages option
Update the Layout, Privacy Page, and About page following the details laid out below
Create a static Menu class in your Data project
Update the Index page to dynamically list the full menu provided by the Data library
Update your UML Class Diagrams for:
- Data Project
- Website Project
(You don’t need to create a UML of your test project, though you can if you like)
This assignment is to get you started on creating a ASP.NET project, and using razor pages to implement a website.
Begin by creating a new Razor Pages app named “Website” within your project. Then implement the requirements listed below.
Beyond these core requirements, you may add features and elements as you see fit. Moreover, you are encouraged to style the site using CSS.
The example website images are drawn from a prior semester’s project. You will need to create yours to reflect the information from this semester’s project!
Modify the Razor page named Privacy.cshtml to meet the following guidelines. An example of what this might look like:
- Render a
Create a new Razor page named About.cshtml. It should meet the following guidelines. An example of what this might look like:
- Set the page title to “About”
- Render a
<h1>tag with the text “About Fried Piper”
- Render the following description in a
Founded in 2023 by students of the CIS 400 course, Fried Piper offers the finest and fastest of fried confectioneries for your gastronomical delight.
Modify the existing (created by the template) _Shared/Layout.cshtml to (at a minimum):
- Set the page title to what is provided by the page with the string “- Fried Piper” concatenated to the end
- Provide a navigation link to the new About page, as well as the Privacy page, and the Treats, Poppers, and Platters on the index page.
- Change the copyright statement to “(c) 2022 - Fried Piper LLC.”
You can make the browser scroll to a specific section of the page by adding a
# followed by the
id of the page you want to scroll to. I.e. if you want to scroll to the tag
<h1 id="poppers"> on the home page, the corresponding URL would be
/home#poppers. With a normal anchor tag, this would be:
If you are using the ASP tag helpers, the equivalent tag would be
<a asp-page="Home" asp-fragment="poppers">Poppers</a>.
The navigation bar should look something like:
Create a static Menu class
Data project you should create a static class named
Menu declared in the file Menu.cs which contains the following
Treatswhich returns an
IEnumerable<IMenuItem>containing an instance of all available fried treats (Fried Pie, Fried Ice Cream, Fried Candy Bars, Fried Twinkies). For treats with flavor, filling, or candy bar choices, you must include all the available options.
Popperswhich returns an
IEnumerable<IMenuItem>containing an instance of all available poppers. As each popper has 3 different sizes, this collection should contain a small, medium, and large instance of each. You should also include both glazed and unglazed options for each.
Platterswhich returns an
IEnumerable<IMenuItem>containing all available platters. It should contain one instance of every combination of items possible in a Piper Platter. It should also contain every combination of popper plater (small, medium, and large as both glazed and unglazed).
FullMenushould return an
IEnumerable<IMenuItem>containing all of the items on the menu (one of each of the items found in the categories above).
Modify the existing Index.cshtml page to display the full menu of Fried Piper according to the guidelines that follow. An example of what this might look like:
Add a first-level header (
<h1>) identifying the page as “Fried Piper”.
Under that, add a section greeting the customer with the message:
The finest of fried delights!
List the Menu Categories
List the three categories of menu items (Treats, Poppers, and Platters)
List the Menu Items
Below each of the menu category headers, list the items in that category. Each item should be placed in a
<div> with a class of
<div> should include, nested inside, the name of the item, its price, and its calories. If an item comes in multiple sizes, you will need to list the price and calories for each size.
You may use additional HTML elements to organize and present this information, and use CSS to style it as you see fit.
You should use the methods from your
Menu class in the Data project to determine the entrees, sides, and drinks to display. This will mean using the
Menu class in the model class for the index page, Index.cshtml.cs.
Testing continues to be a critical part of writing our project. You will need to write tests for all of your code in the Data project. We will introduce testing a Razor Page app in a future module, so you don’t need to test it yet.
Testing the Menu Class
You should test your
Menu class to ensure that your properties are returning all the appropriate menu items. Some strategies you may want to employ:
- Checking the count of items in a category matches your expectation (i.e. the poppers category contains 4 poppers, each can be 3 sizes, and 2 values for glazed, for a total of 4x3x2 combinations, or a total of 24 items)
- Checking that each unique combination exists in the category. This can be done with the
Assert.Collection()[Collection Assertions](<ref “/1-object-orientation/04-testing/05-xunit-assertions#collection-assertions”>}})
- As there are a lot of possible combinations, this is one time you may need to include additional logic in your tests (i.e. loops).
Keep in mind that the equality operator (
==) when used with objects tests the two are the exact same object, not that their properties are equal! So to determine if two menu items are equivalent, you either must compare their properties, or override their
Equals() method to compare their properties.
Updating your UML
Data Project UML
Your UML Diagram needs to be updated to reflect any changes you made in this milestone, including adding the
Remember that static classes and methods are underlined in a UML class diagram.
Web Project UML
You will need to add a UML class diagram for your new project. You can either combine this with your existing UML (if you do this, clearly indicate which classes belong to which project), or create a second diagram.
A Razor Page is composed of two parts - the CSHTML rendering template and the CS file containing the page’s model class. Only the class needs to appear in a UML diagram document. It is handled the same way as any class.
Submitting the Assignment
Once your project is complete, merge your feature branch back into the
main branch and create a release tagged
v0.9.0 with name
"Milestone 9". Copy the URL for the release page and submit it to the Canvas assignment.
The grading rubric for this assignment will be:
15% 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?
15% Documentation Does every class, method, property, and field use the correct XML-style documentation? Does every XML comment tag contain explanatory text?
15% 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?
15% UML Diagrams Does your UML diagram reflect the code actually in your release? Are all classes, enums, etc. included? Are associations correctly identified?
20% Functionality Does the program do what the assignment asks? Do properties return the expected values? Do methods perform the expected actions?
20% Testing Do you have unit tests for all classes? Do your unit tests cover all the functionality of those classes? Do you have a written test plan for your GUI? Do you have a record of employing the test plan in your release?
Projects that do not compile will receive an automatic grade of 0.