Пример #1
0
        public async Task Test___Method_Reset___Status_Completed()
        {
            var variable1 = new AnyVariable <int>()
            {
                Value = 0
            };
            var variable2 = new AnyVariable <int>()
            {
                Value = 10
            };

            var testee = new TryCatchActivity()
            {
                Try = new AssignActivity()
                {
                    To = variable1, Value = new AnyVariable <int>()
                    {
                        Value = 20
                    }
                },
                Catch = new AssignActivity()
                {
                    To = variable1, Value = new AnyVariable <int>()
                    {
                        Value = 30
                    }
                },
                Finally = new AssignActivity()
                {
                    To = variable2, Value = variable1
                }
            };

            await testee.Start();

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

            testee.Reset();

            Assert.AreEqual(ActivityStatus.Created, testee.Status);
        }
Пример #2
0
        public void Test___Method_Reset___Status_Stopped()
        {
            var variable1 = new AnyVariable <int>()
            {
                Value = 0
            };
            var variable2 = new AnyVariable <int>()
            {
                Value = 10
            };

            var testee = new TryCatchActivity()
            {
                Try = new AssignActivity()
                {
                    To = variable1, Value = new AnyVariable <int>()
                    {
                        Value = 20
                    }
                },
                Catch = new AssignActivity()
                {
                    To = variable1, Value = new AnyVariable <int>()
                    {
                        Value = 30
                    }
                },
                Finally = new AssignActivity()
                {
                    To = variable2, Value = variable1
                }
            };

            testee.Stop();

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

            testee.Reset();

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