public void PopupInternalError() { var m = new simplewriter { timeout = -1 }; var logger = new BaseLogger { Writers = new[] { m } }; logger.StartWrite(new LogMessage()); var ex = Assert.Throws <LogException>(() => logger.Join()); StringAssert.Contains("myerror", ex.InnerException.Message); }
public void CanThrowTimeOut() { var m = new simplewriter { timeout = 1050 }; var logger = new BaseLogger { Writers = new[] { m } }; logger.StartWrite(new LogMessage()); logger.Join(); logger.StartWrite(new LogMessage()); var ex = Assert.Throws <LogException>(() => logger.Join()); StringAssert.Contains("timeout", ex.Message); }
public void IsAsyncButSynchronizable() { var m = new simplewriter(); var logger = new BaseLogger { Writers = new[] { m } }; logger.StartWrite(new LogMessage()); Assert.False(m.called); //we start write UserLog, but we are async logger.Join(); Assert.True(m.called); //but here we are guaranted to be synchronized for next run // repeat it twice m.called = false; logger.StartWrite(new LogMessage()); Assert.False(m.called); //we start write UserLog, but we are async logger.Join(); Assert.True(m.called); //but here we are guaranted to be synchronized for next run }