コード例 #1
0
        public void ExecutePeriod_HappyPathTest()
        {
            CalculatorOrchestrator calculatorOrchestrator = new CalculatorOrchestrator();
            TextBox textbox = null;
            Thread  t       = new Thread(() =>
            {
                textbox = new TextBox();
                calculatorOrchestrator.input = "10";
                calculatorOrchestrator.ExecutePeriod(textbox);
                Assert.AreEqual("10.", textbox.Text);
            });

            t.SetApartmentState(ApartmentState.STA);
            t.Start();
            t.Join();
        }
コード例 #2
0
        public void ComputeResultPeriodAdd_HappyPathTest()
        {
            CalculatorOrchestrator calculatorOrchestrator = new CalculatorOrchestrator();
            TextBox textbox = null;
            Thread  t       = new Thread(() =>
            {
                textbox = new TextBox();
                calculatorOrchestrator.UpdateNumberToSystem(textbox, "10");
                calculatorOrchestrator.ExecutePeriod(textbox);
                calculatorOrchestrator.UpdateNumberToSystem(textbox, "20");
                calculatorOrchestrator.UpdateOperation(textbox, Operator.Divide);
                calculatorOrchestrator.UpdateNumberToSystem(textbox, "2");

                calculatorOrchestrator.ComputeResult(textbox);
                Assert.AreEqual("5.100", textbox.Text);
            });

            t.SetApartmentState(ApartmentState.STA);
            t.Start();
            t.Join();
        }