public void will_not_crash_when_Run_throws_exception_and_log_func_is_not_set() { var sut = new TestAppService(); sut.WorkFunc = () => { throw new InvalidOperationException(); }; sut.Start(); sut.StartedEvent.WaitOne(10000); sut.Stop(); var actual = sut.StoppedEvent.WaitOne(10000); actual.Should().BeFalse(); }
public void should_be_able_to_restart() { var sut = new TestAppService(); sut.Start(); sut.StartedEvent.WaitOne(100); sut.Stop(); sut.StoppedEvent.WaitOne(100); sut.StartedEvent.Reset(); sut.Start(); sut.StartedEvent.WaitOne(100).Should().BeTrue(); }
public void should_be_able_to_restart() { var sut = new TestAppService(); sut.Start(); sut.StartedEvent.WaitOne(10000); sut.Stop(); sut.StoppedEvent.WaitOne(10000); sut.StartedEvent.Reset(); sut.Start(); sut.StartedEvent.WaitOne(10000).Should().BeTrue(); }
public void should_be_able_to_restart() { var sut = new TestAppService(); sut.FirstInterval = TimeSpan.FromMilliseconds(0); sut.Start(); sut.StartedEvent.WaitOne(10000); sut.Stop(); sut.StoppedEvent.WaitOne(10000); sut.StartedEvent.Reset(); sut.Start(); sut.StartedEvent.WaitOne(10000).Should().BeTrue(); }
public void waits_on_handle_after_restarted() { var sut = new TestAppService(); sut.WorkFunc = handle => handle.WaitOne(500); sut.Start(); sut.StartedEvent.WaitOne(100); sut.Stop(); sut.StoppedEvent.WaitOne(100); sut.StartedEvent.Reset(); sut.Start(); sut.StartedEvent.WaitOne(100).Should().BeTrue(); }
public void waits_on_handle_after_restarted() { var sut = new TestAppService(); sut.WorkFunc = handle => handle.WaitOne(500); sut.Start(); sut.StartedEvent.WaitOne(10000); sut.Stop(); sut.StoppedEvent.WaitOne(10000); sut.StartedEvent.Reset(); sut.Start(); sut.StartedEvent.WaitOne(100).Should().BeTrue(); }