使用VisualStudio2005TeamSystem進行單元測試[7]

發表于:2010-05-13來源:作者:點擊數: 標簽:單元
使用VisualStudio2005TeamSystem進行單元測試[7] 軟件測試 Assert.IsTrue( (currentBalance + depositAmount) target.CurrentBalance, "Deposit not applied correctly"); } [TestMethod()] public void MakePaymentTest() { float currentBalance = 500; Ba

  使用VisualStudio2005TeamSystem進行單元測試[7] 軟件測試

  Assert.IsTrue( (currentBalance + depositAmount) >

  target.CurrentBalance,

  "Deposit not applied correctly");

  }

  [TestMethod()]

  public void MakePaymentTest() {

  float currentBalance = 500;

  BankAclearcase/" target="_blank" >ccount target = new BankAccount(currentBalance);

  float paymentAmount = 250;

  target.MakePayment(paymentAmount);

  Assert.IsTrue(currentBalance - paymentAmount ==

  target.CurrentBalance,

  "Payment not applied correctly");

  }

  }

  }

  主單元測試概念 == 斷言

  用于該形式單元測試的主要概念是,自動化單元測試是基于“斷言”的,即可定義為“事實或您相信為事實的內容”。從邏輯角度看,請考慮該語句“when I do {x}, I expect {y} as a result”。

原文轉自:http://www.anti-gravitydesign.com

国产97人人超碰caoprom_尤物国产在线一区手机播放_精品国产一区二区三_色天使久久综合给合久久97