使用VisualStudio2005TeamSystem進行單元測試[21] 軟件測試
一個私有訪問器和用于 TestContext 的公共屬性。它由單元測試運行器(即 VSTS Unit Test Framework)使用,以便提供關于當前測試運行的信息以及用于該運行的功能。
"
TestInitialize() 和 TestCleanup() 方法。這些方法常用于獲取和釋放測試所需的任何對象。
"
TestMethod(),用于每個選定的方法。
讓我們仔細看一下 DepositMoneyTest(),它負責確保當前的平衡能反映原始數量與累計數量的總和。
///
///A test case for DepositMoney (float)
///
[TestMethod()]
public void DepositMoneyTest()
{
float initialBalance = 0; // TODO: Initialize to an appropriate value
BankAclearcase/" target="_blank" >ccount target = new BankAccount(initialBalance);
float depositAmt = 0; // TODO: Initialize to an appropriate value
target.DepositMoney(depositAmt);
原文轉自:http://www.anti-gravitydesign.com