44 lines
1020 B
C#
Raw Normal View History

2021-09-27 09:31:50 +13:00
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
2021-09-27 10:44:54 +13:00
using Week_10___Account_Library;
2021-09-27 09:31:50 +13:00
namespace Week_10___TDD_Tests
{
[TestClass]
public class TDDTests
{
2021-09-27 10:44:54 +13:00
private Account account;
[TestInitialize]
public void InitTests()
{
account = new Account(1000, 500);
}
[TestMethod]
public void DepositAmount()
{
account.Deposit(200);
Assert.AreEqual(1200, account.Balance);
}
2021-09-27 09:31:50 +13:00
[TestMethod]
2021-09-27 10:44:54 +13:00
public void WithdrawAmount()
{
account.Withdraw(200);
Assert.AreEqual(800, account.Balance);
}
[TestMethod, ExpectedException(typeof(ArgumentOutOfRangeException))]
public void WithdrawNegative()
2021-09-27 09:31:50 +13:00
{
2021-09-27 10:44:54 +13:00
account.Withdraw(-200);
}
2021-09-27 09:31:50 +13:00
2021-09-27 10:44:54 +13:00
[TestMethod, ExpectedException(typeof(ArgumentOutOfRangeException))]
public void DepositNegative()
{
account.Deposit(-200);
2021-09-27 09:31:50 +13:00
}
}
}