Esempio n. 1
0
        public void Test___Method_Reset___Status_Stopped()
        {
            var variable1 = new AnyVariable <int>();
            var variable2 = new AnyVariable <int>();

            var testee = new SequenceActivity()
            {
                Activities = new List <IActivity>()
                {
                    new AssignActivity()
                    {
                        To = variable1, Value = new AnyVariable <int>()
                        {
                            Value = 10
                        }
                    },
                    new AssignActivity()
                    {
                        To = variable2, Value = new AnyVariable <int>()
                        {
                            Value = 20
                        }
                    }
                }
            };

            testee.Stop();

            Assert.AreEqual(ActivityStatus.Stopped, testee.Status);
            Assert.IsNull(variable1.GetValueAsObject());
            Assert.IsNull(variable2.GetValueAsObject());

            testee.Reset();

            Assert.AreEqual(ActivityStatus.Created, testee.Status);
        }
Esempio n. 2
0
        public async Task Test___Method_Reset___Status_Completed()
        {
            var variable1 = new AnyVariable <int>();
            var variable2 = new AnyVariable <int>();

            var testee = new SequenceActivity()
            {
                Activities = new List <IActivity>()
                {
                    new AssignActivity()
                    {
                        To = variable1, Value = new AnyVariable <int>()
                        {
                            Value = 10
                        }
                    },
                    new AssignActivity()
                    {
                        To = variable2, Value = new AnyVariable <int>()
                        {
                            Value = 20
                        }
                    }
                }
            };

            await testee.Start();

            Assert.AreEqual(ActivityStatus.Completed, testee.Status);
            Assert.AreEqual(10, variable1.GetValueAsObject());
            Assert.AreEqual(20, variable2.GetValueAsObject());

            testee.Reset();

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