예제 #1
0
        public void It_should_be_performed()
        {
            var done = new ManualResetEvent(false);

            IActiveObject ao = new ActiveTest();
            ao.Start();

            ao.PushAction(() => done.Set());

            Assert.That(done.WaitOne(100), Is.True);

            ao.Stop();
        }
예제 #2
0
        public void Counters_should_be_updated()
        {
            IActiveObject ao = new ActiveTest();
            ao.Start();

            ao.PushAction(() => {});
            Thread.Sleep(100);

            var counters = ao.GetCounters;

            Assert.That(counters.Posted == 1);
            Assert.That(counters.Started == 1);
            Assert.That(counters.Completed == 1);
            Assert.That(counters.Succeeded == 1);
            Assert.That(counters.Failed == 0);

            ao.Stop();
        }