示例#1
0
        public void Test___Method_Reset___Status_Stopped()
        {
            var to = new AnyVariable <int>()
            {
                Value = 0
            };

            var testee = new IfActivity()
            {
                Condition = new TrueCondition(),
                Then      = new AssignActivity()
                {
                    To = to, Value = new AnyVariable <int>()
                    {
                        Value = 1
                    }
                },
                Else = new AssignActivity()
                {
                    To = to, Value = new AnyVariable <int>()
                    {
                        Value = 2
                    }
                }
            };

            testee.Stop();

            Assert.AreEqual(ActivityStatus.Stopped, testee.Status);
            Assert.AreEqual(0, to.GetValueAsObject());

            testee.Reset();

            Assert.AreEqual(ActivityStatus.Created, testee.Status);
        }
示例#2
0
        public async Task Test___Method_Stop___Status_Suspended()
        {
            var testee = new IfActivity()
            {
                Condition = new TrueCondition(),
                Then      = new SuspendActivity()
                {
                    Until = new FalseCondition()
                }
            };

            await testee.Start();

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

            testee.Stop();

            Assert.AreEqual(ActivityStatus.Stopped, testee.Status);
        }
示例#3
0
        public async Task Test___Method_Stop___Status_Executing()
        {
            var testee = new IfActivity()
            {
                Condition = new TrueCondition(),
                Then      = new DelayActivity()
                {
                    Duration = new AnyVariable <int>()
                    {
                        Value = 1000
                    }
                }
            };

            var task = testee.Start();

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

            testee.Stop();

            await task;

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