コード例 #1
0
ファイル: SwitchActivityTest.cs プロジェクト: np-albus/WFLite
        public void Test___Method_Reset___Status_Stopped()
        {
            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());

            testee.Reset();

            Assert.AreEqual(ActivityStatus.Created, testee.Status);
        }
コード例 #2
0
ファイル: SwitchActivityTest.cs プロジェクト: np-albus/WFLite
        public async Task Test___Method_Reset___Status_Completed()
        {
            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
                          }
                      } }
                }
            };

            await testee.Start();

            Assert.AreEqual(ActivityStatus.Completed, testee.Status);
            Assert.AreEqual(100, to.GetValue());

            testee.Reset();

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