public void TestCalculate(double firstValue, double expected) { IOneArgumentsCalculator calculator = OneArgumentsFactory.CreateCalculator("ten_in_th_degree"); double result = calculator.Calculate(firstValue); Assert.AreEqual(expected, result); }
public void TestCalculate(double firstValue, double expected) { IOneArgumentsCalculator calculator = OneArgumentsFactory.CreateCalculator("squareroot"); double result = calculator.Calculate(firstValue); Assert.AreEqual(expected, result); if (firstValue < 0) { throw new Exception("Не верный индетефикатор"); } }
private void button_Click(object sender, EventArgs e) { try { string firstArgument = textBox1.Text; string nameButton = ((Button)sender).Name; IOneArgumentsCalculator calculator = OneArgumentsFactory.CreateCalculator(nameButton); textBox1.Text = calculator.Calculate(firstArgument); } catch (Exception exception) { textBox1.Text = exception.Message; } }
private void btn_ClickOneArgument(object sender, EventArgs e) { try { double firstArgument = Convert.ToDouble(textBox1.Text); IOneArgumentsCalculator calculator = OneArgumentsFactory.CreateCalculator(((Button)sender).Name); double result = calculator.Calculate(firstArgument); textBox3.Text = result.ToString(CultureInfo.InvariantCulture); } catch (Exception exception) { textBox3.Text = exception.Message; } }
private void OneArgumentButtonClick(object sender, EventArgs e) { try { double first = Convert.ToDouble(Input1.Text); IOneArgumentsCalculator calculator = OneArgumentsFactory.CreateCalculator(((Button)sender).Name); double result = calculator.Calculate(first); Result.Text = Convert.ToString(result); } catch (Exception exc) { MessageBox.Show("Возникла ошибка:" + exc.Message); } }
private void OneArgumentOperation_Click(object sender, EventArgs e) { try { double firstArgument = Convert.ToDouble(textBox1.Text); IOneArgumentCalculator calculator = OneArgumentsFactory.CreateCalculator(((Button)sender).Name); double result = calculator.Calculate(firstArgument); label1.Text = Convert.ToString(result); } catch (Exception exc) { MessageBox.Show("ошибка: " + exc.Message); } }
public void ClicklingOne(object sender, EventArgs e) { try { var firstArgument = Convert.ToDouble(textBoxEntering1.Text); var calculator = OneArgumentsFactory.CreateCalculator(((Button)sender).Name); double result = calculator.OneArgumentOperation(firstArgument); labelOut.Text = result.ToString(); } catch (Exception exception) { MessageBox.Show("Возникла ошибка :" + exception.Message); } }
private void OneArgumentCalculate(object sender, EventArgs e) { try { double firstArgument = Convert.ToDouble(textBox1.Text); IOneArgumentCalculator calculator = OneArgumentsFactory.CreateCalculator(((Button)sender).Name); var result = calculator.Calculate(firstArgument); textBox3.Text = result.ToString(); } catch (Exception exc) { // обработка исключения } }
public void CalculateTest(string name, Type type) { var calculator = OneArgumentsFactory.CreateCalculator(name); Assert.IsInstanceOf(type, calculator); }