Question
in C# Please! - Run your existing unit tests and ensure they all pass, specifically the ones testing the Withdrawl method. A failure would indicate
in C# Please!
- Run your existing unit tests and ensure they all pass, specifically the ones testing the Withdrawl method. A failure would indicate that the change to you Withdrawl method is not returning the expected results, meaning the method needs to be fixed.
- Create a new unit test to test the out of network functionality for your withdrawl method. You should verify that the Withdrawl method deducts an addtional $2.50 on top of the Withdrawl amount. Make sure you tests ALL outcomes you can think of from this scenario (HINT there are two).
- Write unit tests that assure your PayMortgage method is working as expected. Again, there are multiple scenarios here you will want to test. Don't simply test that the deducted principal is correct, as there are cases where the parameters fed in should produce different results (those edge cases I was reffering to earlier).
- Verify all tests pass
using Week3UnitTests.Model;
namespace Week3UnitTests.Test { [TestClass] public class UnitOfWorkTests { List
public UnitOfWorkTests() { _customers = new List
// act unitOfWork.Deposit(1, 20);
// assert Assert.AreEqual(220, _customers[0].CurrentBalance); }
[TestMethod] public void Deposit_UserExistsAndAmountLT0_ThrowsException() { // arrange UnitOfWork unitOfWork = new UnitOfWork(_customers);
// act and assert Assert.ThrowsException
[TestMethod] public void Deposit_UserDoesNotExist_ThrowsException() { // arrange UnitOfWork unitOfWork = new UnitOfWork(_customers);
// act and assert Assert.ThrowsException
[TestMethod] public void Withdrawal_UserExistsAndAmountIsNegative_CurrentBalanceDeducted() { // arrange UnitOfWork unitOfWork = new UnitOfWork(_customers);
// act unitOfWork.Withdrawal(2, -20);
// asssert Assert.AreEqual(-10, _customers[1].CurrentBalance); }
[TestMethod] public void Withdrawal_UserExistsButAmountIsPostive_ThrowException() { // arrange UnitOfWork unitOfWork = new UnitOfWork(_customers);
// act and assert Assert.ThrowsException
[TestMethod] public void Withdrawal_UserDoesNotExist_ThrowException() { // arrange UnitOfWork unitOfWork = new UnitOfWork(_customers);
// act and assert Assert.ThrowsException
[TestMethod] public void GetBalance_UserDoesNotExist_ThrowException() { // arrange UnitOfWork unitOfWork = new UnitOfWork(_customers);
// act and assert Assert.ThrowsException
[TestMethod] public void GetBalance_UserExists_ReturnsBalance() { // arrange UnitOfWork unitOfWork = new UnitOfWork(_customers);
// act decimal result = unitOfWork.GetBalance(3);
// assert Assert.AreEqual(9001, result); }
} }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started