PROG2070: Winter 2024
Programming – Software Quality Assurance
For this assignment, you are going to develop and test a class for a simple C# console
application (.NET Framework). You will not need to create the console app, but you
will need to assess the quality of that application by developing and executing unit
tests on its supporting class. The requirement for the application is that it allows a
user to work with and modify the attributes associated with a rectangle. You will also
use Git as source control for this project.
Create a new console application project in Visual Studio, and select a location on
your hard drive. Make note of the folder where you created the Solution. Once this
has been completed, use Git Bash to initialize a Git repository within the Solution
folder you just created. You know you are within the correct folder if you run an ls
command in Git Bash and see a .sln file and the folder
(there may be a few other files and folders, but these two will
definitely be there). Do your first initial commit of your solution folder in git.
Return to Visual Studio and begin work on your application. Begin by creating a new
Rectangle class as a separate file. The Rectangle class should have two private
integer attributes which hold the length and width of the rectangle object. The
Rectangle class should contain a default constructor, which sets the length and width
each to the value of 1, and a non-default constructor, which sets the length and
width to whatever the user inputs.
The Rectangle class must be public, and should contain six methods, plus a default
and non-default Constructor. The six methods are:
public int GetLength()
public
int SetLength(int length)
public int GetWidth()
int SetWidth(int width)
int GetPerimeter()
GetArea()
public
public
public int
Each method should do the action as described by its method name. The SetLength
method overwrites the old length with the new length. The SetWidth method
overwrites the old width with the new width.
When you have completed work on the Rectangle class, return to Git Bash. Stage and
commit your entire solution and label the commit as containing the completed
Rectangle class.
For this assignment, you only need to work with your Rectangle class. This class
should be separate from the Program class. However, the Program class does not
need any functional code.
Return to Visual Studio and begin work on creating unit tests for each of the six
regular methods within the Rectangle class. You do not need to test the constructors.
This work should be done within its own Project, as described in class. Your solution
in Visual Studio should look similar to the following:
You have your Main Project, which contains a placeholder class for your application
(Program.cs in Figure 1) and the Rectangle class (Rectangle.cs in Figure 1). You will
have a second project in the same solution containing the test cases. Remember the
naming conventions for the Test Project, the Test Class, and the Test Methods.
Develop three (3) unit test cases for each of the above six methods for a total of 18
unit tests.
For your tests, assume the maximum intended values for Length and Width are 4500.
Each of your tests MUST use the Assert.AreEqual() assert method using the
appropriate expected and actual variables.
Ensure that your tests are properly named as per the convention shown in the slides
and that they are created using the proper A-A-A format along with the appropriate
spacing. You should also use Boundary Value Analysis when selecting your test data.
When you have completed work on the unit tests, return to Git Bash. Stage and
commit your entire solution, and label the commit as containing the completed unit
tests.
Provide a single screenshot of all 18 Unit cases being run in the Visual Studio Test
Explorer – do not submit 18 separate screenshots of each individual unit test. All of
your unit tests should pass and be based on correct inputs and expected results.
Provide a screenshot or output from a git log command showing your three
commits. Feel free to run more commits as it makes sense for your project and work
schedule. But at minimum, there should be the three commits as described in the
assignment.
Submissions
The format for submitting the assignment is as follows.
submission containing:
1. A single MS Word document named:
Group#_Student1FirstName_ Student2FirstName_Assignment2.docx
The Word document should contain (in order):
a. Assignment Title Page with your names, student IDs,
“Assignment #2” in the title and date;
b. Screenshot showing the results of your unit tests being run in
Test Explorer, and a screenshot/output of your git repository
log.
c. Copy of Rectangle class source code (The Rectangle.cs in
example Figure 1 screenshot)
d. Copy of Unit Test class source code (The RectangleTest.cs in
example Figure 1 screenshot)
When providing a “copy” of your code in the document, please do
not screenshot it, but rather copy the code from Visual Studio and
paste it into your submission document.
2. A single compressed (.zip format) archive file containing:
a. the entire Solution folder of your source code. (Do not include
the .docx file in the .zip file)
b. Your Git repository
Please submit the above to the “Assignment #2” assignment folder