public void TestMethodDiv() { double oper1 = 6; double oper2 = 2.5; string expected = "2.4"; string actual = StatndardCalc.Div(oper1, oper2); Assert.AreEqual(expected, actual); }
private void equals_Click(object sender, EventArgs e) { double textBox; if (!Double.TryParse(display.Text, out textBox)) { buttonC.PerformClick(); } switch (_operation) { case "+": display.Text = StatndardCalc.Plus(_buf, textBox); break; case "-": display.Text = StatndardCalc.Minus(_buf, textBox); break; case "*": display.Text = StatndardCalc.Mul(_buf, textBox); break; case "÷": if (textBox == 0) { display.Font = new Font("Microsoft Sans Serif", 26F); display.Text = "Can not divide by zero "; _tryDivByZero = true; } else { display.Text = StatndardCalc.Div(_buf, textBox); } break; default: break; } _buf = 0; if (!_operationEntered || !_texted) { _operation = null; if (!_tryDivByZero) { label1.Text = null; } } _operationEntered = true; }