2013년 1월 28일 월요일

asp.mvc webcall AreEqual

public double AccountBlalance(double cBalance, double tAmount)
{
   double finalBalance = 0.00;
   finalBalance = cBalance + tAmount;
   return finalBalance;
}


use..


[TestMechod()]
public void AccountBalanceTest()
{
    double cBalance = 17.05;
    double tAmount = 7.03;
    double fBalace = 2.08;
    double result = 0.00;

     return = AccountBalance(cBalance, tAmount);
    Assert.AreEqual(fBalance, result);
}




<TestMethod()> _
Public Sub Parse_EmptyString_ReturnsZero()
    Dim c As New Calc
    Const ZERO As Integer = 0
    Dim emptyStringParsedResult As Integer = c.Parse("")
    Assert.AreEqual(ZERO, emptyStringParsedResult)
End Sub

<TestMethod()> _
Public Sub Parse_StringWithOneDigit_ReturnsSameDigit()
    Dim c As New Calc
    Const SAME_DIGIT As Integer = 1
    Dim digitParseResult As Integer = c.Parse("1")
    Assert.AreEqual(SAME_DIGIT, digitParseResult)
End Sub


http://msdn.microsoft.com/en-us/magazine/cc163665.aspx

댓글 없음: