예제 #1
0
        public void Test___Method_Stop___Status_Created()
        {
            var value = new AnyVariable <string>();
            var to    = new AnyVariable <string>();

            var testee = new ForEachActivity()
            {
                Enumerable = new AnyVariable <IEnumerable>()
                {
                    Value = new List <object>()
                    {
                        "foo",
                        "bar",
                        "baz"
                    }
                },
                Value    = value,
                Activity = new AssignActivity()
                {
                    To    = to,
                    Value = value
                }
            };

            testee.Stop();

            Assert.AreEqual(ActivityStatus.Stopped, testee.Status);
            Assert.IsNull(to.GetValueAsObject());
        }
예제 #2
0
        public async Task Test___Method_Stop___Status_Executing()
        {
            var value = new AnyVariable <int>();

            var testee = new ForEachActivity()
            {
                Enumerable = new AnyVariable <IEnumerable>()
                {
                    Value = new List <object>()
                    {
                        2000,
                        2000,
                        2000
                    }
                },
                Value    = value,
                Activity = new DelayActivity()
                {
                    Duration = value
                }
            };

            var task = testee.Start();

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

            Thread.Sleep(3000);

            testee.Stop();

            await task;

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