public void BatchErrorHandlingTest() { var fileTarget = new FileTarget { FileName = "${logger}", Layout = "${message}" }; fileTarget.Initialize(null); // make sure that when file names get sorted, the asynchronous continuations are sorted with them as well var exceptions = new List<Exception>(); var events = new[] { new LogEventInfo(LogLevel.Info, "file99.txt", "msg1").WithContinuation(exceptions.Add), new LogEventInfo(LogLevel.Info, "", "msg1").WithContinuation(exceptions.Add), new LogEventInfo(LogLevel.Info, "", "msg2").WithContinuation(exceptions.Add), new LogEventInfo(LogLevel.Info, "", "msg3").WithContinuation(exceptions.Add) }; fileTarget.WriteAsyncLogEvents(events); Assert.Equal(4, exceptions.Count); Assert.Null(exceptions[0]); Assert.NotNull(exceptions[1]); Assert.NotNull(exceptions[2]); Assert.NotNull(exceptions[3]); }