public void Restart_handle() { var testHandler = new TestHandler(false); TestHandler.New.Reset(); var monitor = new Monitor(testHandler); monitor.StopWaitTimeout = 200; monitor.Start(); testHandler.Aborted.WaitOne(1000); TestHandler.New.WaitOne(1000); monitor.Stop(); var l = new PatternLayout("%date{HH:mm:ss.fff} [%-5thread] %-5level %-29logger{1} %message%n"); var writer = new StringWriter(); foreach (var e in events.Events) { l.Format(writer, e); } Assert.That(TestHandler.Handlers.Count, Is.EqualTo(2), writer.ToString()); Assert.That(TestHandler.Handlers[1].Started, Is.GreaterThan(DateTime.MinValue)); }
protected override void OnStart(string[] args) { monitor.Start(); }