コード例 #1
0
ファイル: UnitTest1.cs プロジェクト: jasonrdonald/Hello
 public void Withdraw_AmountMoreThanBalance_Throws()
 {
     // arrange
     var account = new Calc("John Doe", 10.0);
     // act
     account.Withdraw(11.0);
     // assert is handled by the ExpectedException
 }
コード例 #2
0
ファイル: UnitTest1.cs プロジェクト: jasonrdonald/Hello
 public void Withdraw_ValidAmount_ChangesBalance()
 {
     // arrange
     double currentBalance = 10.0;
     double withdrawal = 1.0;
     double expected = 9.0;
     var account = new Calc("JohnDoe", currentBalance);
     // act
     account.Withdraw(withdrawal);
     double actual = account.Balance;
     // assert
     Assert.AreEqual(expected, actual);
 }