Ejemplo n.º 1
0
        public async Task Test___Method_Start___Status_Suspended_to_Suspended()
        {
            var value = new AnyVariable <bool>()
            {
                Value = false
            };

            var testee = new DelegateActivity()
            {
                Activity = new SuspendActivity()
                {
                    Until = new TrueCondition()
                    {
                        Value = value
                    }
                }
            };

            await testee.Start();

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

            await testee.Start();

            Assert.AreEqual(ActivityStatus.Suspended, testee.Status);
        }
Ejemplo n.º 2
0
        public async Task Test___Method_Stop___Status_Executing()
        {
            var testee = new DelegateActivity()
            {
                Activity = new DelayActivity()
                {
                    Duration = new AnyVariable <int>()
                    {
                        Value = 5000
                    }
                }
            };

            var task = testee.Start();

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

            Thread.Sleep(1000);

            testee.Stop();

            await task;

            Assert.AreEqual(ActivityStatus.Stopped, testee.Status);
        }
Ejemplo n.º 3
0
        protected virtual bool Visit <TInstance>(DelegateActivity <TInstance> activity)
            where TInstance : class
        {
            Trace.WriteLine("({0})[{1}] Action({2})".FormatWith(activity.State, activity.Event,
                                                                typeof(TInstance).ToShortTypeName()));

            return(true);
        }
Ejemplo n.º 4
0
        public async Task Test___Method_Start___Status_Created_to_Suspended()
        {
            var testee = new DelegateActivity()
            {
                Activity = new SuspendActivity()
                {
                    Until = new FalseCondition()
                }
            };

            await testee.Start();

            Assert.AreEqual(ActivityStatus.Suspended, testee.Status);
        }
Ejemplo n.º 5
0
        public async Task Test___Method_Start___Status_Created_to_Completed()
        {
            var testee = new DelegateActivity()
            {
                Activity = new DelayActivity()
                {
                    Duration = new AnyVariable <int>()
                    {
                        Value = 1000
                    }
                }
            };

            await testee.Start();

            Assert.AreEqual(ActivityStatus.Completed, testee.Status);
        }
Ejemplo n.º 6
0
        public void Test___Method_Stop___Status_Created()
        {
            var testee = new DelegateActivity()
            {
                Activity = new DelayActivity()
                {
                    Duration = new AnyVariable <int>()
                    {
                        Value = 1000
                    }
                }
            };

            testee.Stop();

            Assert.AreEqual(ActivityStatus.Stopped, testee.Status);
        }
Ejemplo n.º 7
0
        public void Configure(ActivityBuilder <TWorkflow, TInstance> builder)
        {
            var activity = new DelegateActivity <TInstance>(builder.State, builder.Event, _action);

            builder.AddActivity(activity);
        }