private void OneCalculate(object sender, EventArgs e) { try { string firstValue = textBox1.Text; double first = Convert.ToDouble(firstValue); ISingleCalculator calculate = SingleFactory.CreateCalculator(((Button)sender).Name); var third = calculate.Calculate(first); Rez.Text = third.ToString(); } catch (Exception ex) { MessageBox.Show("произошла ошибка: " + ex.Message); } }
private void SingleOperation(object sender, EventArgs e) { try { double firstnumber = Convert.ToDouble(textBox1.Text); IOneArg calc = SingleFactory.CreateCalc(((Button)sender).Name); double result = calc.Calc(firstnumber); label1.Text = Convert.ToString(result); } catch (Exception exception) { MessageBox.Show("Произошла ошибка: " + exception.Message); } }
public void CreateCalcTest(string name, Type type) { IOneArg calc = SingleFactory.CreateCalc(name); Assert.IsInstanceOf(type, calc); }
public void AddTest(string name, Type type) { ISingleCalculator calculate = SingleFactory.CreateCalculator(name); Assert.IsInstanceOf(type, calculate); }
public SingleFactoryShould() { _actorSingleFactory = new SingleFactory <IActorContext>(typeof(SingleActor <>)); _contract = typeof(SingleActor <TestActor>); }