コード例 #1
0
ファイル: Form1.cs プロジェクト: rozamurzabekova/calc
 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);
     }
 }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
        public void CreateCalcTest(string name, Type type)
        {
            IOneArg calc = SingleFactory.CreateCalc(name);

            Assert.IsInstanceOf(type, calc);
        }
コード例 #4
0
        public void AddTest(string name, Type type)
        {
            ISingleCalculator calculate = SingleFactory.CreateCalculator(name);

            Assert.IsInstanceOf(type, calculate);
        }
コード例 #5
0
 public SingleFactoryShould()
 {
     _actorSingleFactory = new SingleFactory <IActorContext>(typeof(SingleActor <>));
     _contract           = typeof(SingleActor <TestActor>);
 }