Unit Testing and Debugging C# Code in Visual Studio Assignment Overview In this assignment, you will gain experience using lightweight unit tests and other Visual Studio debugging tools to complete...

1 answer below »

Unit Testing and Debugging C# Code in Visual Studio


Assignment Overview


In this assignment, you will gain experience using lightweight unit tests and other Visual Studio debugging tools to complete the code for a C# console application using a basic form of test-driven development.


The application is a relatively simple pay calculator that asks the user to enter the hourly rate of a pay for an employee and then to enter the hours worked for each week in the 4-week pay period. The program then calculates the gross pay for the pay period, the tax, and the net pay. Here are the business rules for these calculations:



  • Any hours in a week over 40 are counted as overtime and paid at time and half.

  • The first $800.00 of gross pay is taxed at 15%, and any gross pay over $800.00 is taxed at 20%.

  • The net pay equals the gross pay minus the taxes.


Assignment Instructions



  1. Download the file cf_u03a1_Unit_Testing.ZIP from the Resources.

  2. Extract the PayCalculator solution from the ZIP file and open it in Visual Studio. After opening it, you will see that the solution consists of 2 projects: PayCalculator and PayCalculatorTest.

  3. The PayCalculatorTest project contains the unit tests that will guide and test the completion of the code for the following methods in the PayCalculator project:

    • GetGrossPay()

    • GetTax()

    • GetNetPay()

    • ToString()



  4. Start the coding by completing the unit test methods. Double check the arithmetic used in the test methods to confirm the accuracy of the results.

  5. Before writing the code for the PayCalculator methods, run the unit tests in the test project and confirm that they all fail.

  6. Complete the code for the methods in PayCalculator one at a time. After finishing each method, rerun the unit tests to confirm that the method produces correct results. Use the Visual Studio debugger to track down and correct problems. Document your progress with at least 8 screenshots pasted into a Word document.

  7. Zip the completed Visual Studio solution (containing the PayCalculator and PayCalculatorTest project). Submit the zipped Visual Studio solution and the Word document with the screenshots.


Assignment Requirements


Ensure that your completed program does the following:



  • Write a syntactically correct C# console program that compiles and runs without warnings or errors.

  • Complete the code for the unit tests in the PayCalculatorTest project to confirm that the methods in PayCalculator produce correct results.

  • Code the methods in the PayCalculator guided by the results of the unit tests and Visual Studio debugging tools.

  • Submit the following:

    • 8 screenshots pasted into a Word document.

    • ZIP file of the completed Visual Studio solution.



Answered 1 days AfterApr 24, 2022

Answer To: Unit Testing and Debugging C# Code in Visual Studio Assignment Overview In this assignment, you will...

Aditya answered on Apr 26 2022
86 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here