本文整理汇总了C#中Calculator.Multiply方法的典型用法代码示例。如果您正苦于以下问题:C# Calculator.Multiply方法的具体用法?C# Calculator.Multiply怎么用?C# Calculator.Multiply使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Calculator
的用法示例。
在下文中一共展示了Calculator.Multiply方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CalculateButton_Click
protected void CalculateButton_Click(object sender, EventArgs e)
{
if (ValueBox1.Text.Length > 0 && ValueBox2.Text.Length > 0)
{
double result = 0;
double value1 = Convert.ToDouble(ValueBox1.Text);
double value2 = Convert.ToDouble(ValueBox2.Text);
Calculator myCalculator = new Calculator();
Trace.Write(string.Format("Performing the calculation with the {0} operator", OperatorList.SelectedValue));
switch (OperatorList.SelectedValue)
{
case "+":
result = myCalculator.Add(value1, value2);
break;
case "-":
result = myCalculator.Subtract(value1, value2);
break;
case "*":
result = myCalculator.Multiply(value1, value2);
break;
case "/":
result = myCalculator.Divide(value1, value2);
break;
}
ResultLabel.Text = result.ToString();
}
else
{
ResultLabel.Text = string.Empty;
Trace.Warn("Custom Category", "TextBox controls are empty; time to add Validation controls?");
}
}
示例2: CalculateButton_Click
protected void CalculateButton_Click(object sender, EventArgs e)
{
if (ValueBox1.Text.Length > 0 && ValueBox2.Text.Length > 0)
{
double result = 0;
double value1 = Convert.ToDouble(ValueBox1.Text);
double value2 = Convert.ToDouble(ValueBox2.Text);
Calculator myCalculator = new Calculator();
switch (OperatorList.SelectedValue)
{
case "+":
result = myCalculator.Add(value1, value2);
break;
case "-":
result = myCalculator.Subtract(value1, value2);
break;
case "*":
result = myCalculator.Multiply(value1, value2);
break;
case "/":
result = myCalculator.Divide(value1, value2);
break;
}
ResultLabel.Text = result.ToString();
}
else
{
ResultLabel.Text = string.Empty;
}
}
示例3: TestMultiplyNumbers
public void TestMultiplyNumbers() {
//Arange
var calc = new Calculator();
//Act
var result = calc.Multiply(9, 4);
//Assert
Assert.AreEqual(36, result);
}
示例4: TestMultiplyNumbers
public void TestMultiplyNumbers() {
//Arrange
var calculator = new Calculator();
//Act
var result = calculator.Multiply(23, 3);
//Assert
Assert.AreEqual(69, result);
}
示例5: MultiplyTest
public void MultiplyTest()
{
// arrange
Calculator calc = new Calculator();
int number1 = 5;
int number2 = 7;
int expected = 35;
// act
int actual = calc.Multiply(number1, number2);
// assert
Assert.AreEqual(expected, actual);
}
示例6: TestMultiply
public void TestMultiply()
{
var calc = new Calculator();
var result = calc.Multiply(17, 3);
Assert.AreEqual(51, result);
}
示例7: MultiplyTwoNumbers
public void MultiplyTwoNumbers()
{
calculator = new Calculator();
Assert.That(calculator.Multiply(2, 4), Is.EqualTo(8));
}
示例8: CanMultiply
public void CanMultiply()
{
Calculator c = new Calculator();
Assert.AreEqual(8, c.Multiply(4, 2));
}