本文整理汇总了C#中Calculator.Sum方法的典型用法代码示例。如果您正苦于以下问题:C# Calculator.Sum方法的具体用法?C# Calculator.Sum怎么用?C# Calculator.Sum使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Calculator
的用法示例。
在下文中一共展示了Calculator.Sum方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: sum_with_negative_5_and_5_then_10_negative
public void sum_with_negative_5_and_5_then_10_negative()
{
//Arrange
var calc = new Calculator();
//Act
var result = calc.Sum(-5, -5);
//Assert
Assert.AreEqual(-10, result);
}
示例2: sum_with_5_and_5_return_10
public void sum_with_5_and_5_return_10()
{
//Arrange
var calc = new Calculator();
//Act
var result = calc.Sum(5, 5);
//Assert
Assert.AreEqual(10, result);
}
示例3: TestMultFalse
public void TestMultFalse()
{
try
{
Calculator calc = new Calculator();
object c = new Calculator();
int result = calc.Sum(4, 2);
Assert.AreNotEqual(3, result);
}
catch (Exception e)
{
throw e;
}
}
示例4: Sum_TenAndFiveWithDotNet11_Returns15
public void Sum_TenAndFiveWithDotNet11_Returns15()
{
Calculator c = new Calculator(10, 5);
Assert.AreEqual(15, c.Sum());
}
示例5: TestSumTrue
public void TestSumTrue()
{
try
{
Calculator calc = new Calculator();
object c = new Calculator();
int result = calc.Sum(3, 4);
Assert.AreEqual(7, result);
}
catch (Exception e)
{
throw e;
}
}