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(); }
public void It_is_performed_withing_different_thread() { Thread current = Thread.CurrentThread; Thread actual = null; IActiveObject ao = new ActiveTest(); ao.Start(); ao.PushAction(() => actual = Thread.CurrentThread ); Thread.Sleep(100); Assert.That(actual, Is.Not.Null); Assert.That(actual, Is.Not.SameAs(current)); }
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(); }