Exemple #1
0
        public async Task Test___Method_Start___Status_Created___Condition_False()
        {
            var variable = new AnyVariable <bool>()
            {
                Value = false
            };
            var duration = new AnyVariable <int>()
            {
                Value = 1000
            };

            var testee = new WhileActivity()
            {
                Condition = new TrueCondition()
                {
                    Value = variable
                },
                Activity = new DelayActivity()
                {
                    Duration = duration
                }
            };

            await testee.Start();

            Assert.AreEqual(ActivityStatus.Completed, testee.Status);
        }
Exemple #2
0
        public async Task Test___Method_Start___Status_Created___Condition_True()
        {
            var variable = new AnyVariable <bool>()
            {
                Value = true
            };
            var duration = new AnyVariable <int>()
            {
                Value = 1000
            };

            var testee = new WhileActivity()
            {
                Condition = new TrueCondition()
                {
                    Value = variable
                },
                Activity = new DelayActivity()
                {
                    Duration = duration
                }
            };

            var task = testee.Start();

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

            Thread.Sleep(3000);

            variable.SetValue(false);

            await task;

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