예제 #1
0
        public async Task Test___Method_Reset___Status_Completed()
        {
            var elapsed = new AnyVariable <long>()
            {
                Value = 0
            };

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

            await testee.Start();

            Assert.AreEqual(ActivityStatus.Completed, testee.Status);
            Assert.AreNotEqual(0, elapsed.GetValueAsObject());

            testee.Reset();

            Assert.AreEqual(ActivityStatus.Created, testee.Status);
        }
예제 #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);
        }