public void TestEventLogFlushInterval() { var writer = new ShimEventLogWriter(new MonitorConfiguration() { EventLogInterval = 100.0 / 60000 //100ms }); //Try to refresh timestamp for last flush. //A flush will be triggered if required. //And the timestamp will be reset to NOW writer.Write(LogLevel.Error, ""); //Clear flushed flag and write a log record. writer.Flushed = false; writer.Write(LogLevel.Info, ""); Assert.IsFalse(writer.Flushed); //Clear flushed flag and wait for 120ms writer.Flushed = false; Thread.Sleep(120); //Trigger a flush and check the flag. writer.Write(LogLevel.Info, ""); Assert.IsTrue(writer.Flushed); }