コード例 #1
0
ファイル: SwitchActivityTest.cs プロジェクト: np-albus/WFLite
        public async Task Test___Method_Stop___Status_Suspended()
        {
            var testee = new SwitchActivity()
            {
                Value = new AnyVariable <int>()
                {
                    Value = 1
                },
                Cases = new Dictionary <object, IActivity>()
                {
                    { 1, new SuspendActivity()
                      {
                          Until = new FalseCondition()
                      } }
                }
            };

            await testee.Start();

            Assert.AreEqual(ActivityStatus.Suspended, testee.Status);

            testee.Stop();

            Assert.AreEqual(ActivityStatus.Stopped, testee.Status);
        }
コード例 #2
0
ファイル: SwitchActivityTest.cs プロジェクト: np-albus/WFLite
        public void Test___Method_Stop___Status_Created()
        {
            var to = new AnyVariable();

            var testee = new SwitchActivity()
            {
                Value = new AnyVariable <int>()
                {
                    Value = 1
                },
                Cases = new Dictionary <object, IActivity>()
                {
                    { 1, new AssignActivity()
                      {
                          To = to, Value = new AnyVariable()
                          {
                              Value = 100
                          }
                      } },
                    { 2, new AssignActivity()
                      {
                          To = to, Value = new AnyVariable()
                          {
                              Value = 1000
                          }
                      } }
                }
            };

            testee.Stop();

            Assert.AreEqual(ActivityStatus.Stopped, testee.Status);
            Assert.IsNull(to.GetValue());
        }
コード例 #3
0
ファイル: SwitchActivityTest.cs プロジェクト: np-albus/WFLite
        public async Task Test___Method_Stop___Status_Executing()
        {
            var to = new AnyVariable();

            var testee = new SwitchActivity()
            {
                Value = new AnyVariable <int>()
                {
                    Value = 1
                },
                Cases = new Dictionary <object, IActivity>()
                {
                    { 1, new DelayActivity()
                      {
                          Duration = new AnyVariable <int>()
                          {
                              Value = 1000
                          }
                      } },
                    { 2, new AssignActivity()
                      {
                          To = to, Value = new AnyVariable()
                          {
                              Value = 1000
                          }
                      } }
                }
            };

            var task = testee.Start();

            Assert.AreEqual(ActivityStatus.Executing, testee.Status);

            testee.Stop();

            await task;

            Assert.AreEqual(ActivityStatus.Stopped, testee.Status);
        }