Ejemplo n.º 1
0
        public async Task Test___Method_Stop___Status_Executing()
        {
            var elapsed = new AnyVariable <long>()
            {
                Value = 0
            };

            var testee = new StopwatchActivity()
            {
                Activity = new DelayActivity()
                {
                    Duration = new AnyVariable <int>()
                    {
                        Value = 1000
                    }
                },
                Elapsed = elapsed
            };

            var task = testee.Start();

            testee.Stop();

            await task;

            Assert.AreEqual(ActivityStatus.Stopped, testee.Status);
            Assert.AreNotEqual(0, elapsed.GetValueAsObject());
        }
Ejemplo n.º 2
0
        public void Test___Method_Reset___Status_Stopped()
        {
            var elapsed = new AnyVariable <long>()
            {
                Value = 0
            };

            var testee = new StopwatchActivity()
            {
                Activity = new DelayActivity()
                {
                    Duration = new AnyVariable <int>()
                    {
                        Value = 1000
                    }
                },
                Elapsed = elapsed
            };

            testee.Stop();

            Assert.AreEqual(ActivityStatus.Stopped, testee.Status);
            Assert.AreEqual(0L, elapsed.GetValue());

            testee.Reset();

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