public void AsyncTargetWrapper_MissingDependency_EnqueueLogEvents() { using (new NoThrowNLogExceptions()) { // Arrange var logFactory = new LogFactory(); logFactory.ThrowConfigExceptions = true; var logConfig = new LoggingConfiguration(logFactory); var asyncTarget = new MyTarget() { Name = "asynctarget", RequiredDependency = typeof(IMisingDependencyClass) }; logConfig.AddRuleForAllLevels(new AsyncTargetWrapper("wrapper", asyncTarget)); logFactory.Configuration = logConfig; var logger = logFactory.GetLogger(nameof(AsyncTargetWrapper_MissingDependency_EnqueueLogEvents)); // Act logger.Info("Hello World"); Assert.False(asyncTarget.WaitForWriteEvent(50)); logFactory.ServiceRepository.RegisterService(typeof(IMisingDependencyClass), new MisingDependencyClass()); // Assert Assert.True(asyncTarget.WaitForWriteEvent()); } }