Beispiel #1
0
        public void Test___Method_Stop___Status_Created()
        {
            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
                }
            };

            testee.Stop();

            Assert.AreEqual(ActivityStatus.Stopped, testee.Status);
        }
Beispiel #2
0
        public async Task Test___Method_Stop___Status_Executing()
        {
            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);

            testee.Stop();

            await task;

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