public void WhenSourceChangedEventIsFired_ThenNewStackIsResolvedToReplaceTheExistingOne() { var newTraceListener = new MockTraceListener("new"); var newStack = new LogWriterStructureHolder( new ILogFilter[0], new Dictionary <string, LogSource>(), new LogSource("all", new[] { newTraceListener }, SourceLevels.All), new LogSource("not processed"), new LogSource("error"), "default", false, false, false); var container = new UnityContainer(); container.RegisterInstance(newStack); this.coordinator.RaiseLoggingUpdate(new UnityServiceLocator(container)); var logEntry = new LogEntry() { Message = "message" }; this.logWriter.Write(logEntry); Assert.AreSame(logEntry, newTraceListener.tracedData); }
public void CanBuildLogWriterStructureHolder() { LogWriterStructureHolder setup = EnterpriseLibraryFactory.BuildUp <LogWriterStructureHolder>(configurationSource); Assert.IsNotNull(setup); Assert.AreEqual(2, setup.TraceSources.Count); }
public void CanBuildLogWriterStructureHolder() { LogWriterStructureHolder setup = EnterpriseLibraryContainer.CreateDefaultContainer(configurationSource) .GetInstance <LogWriterStructureHolder>(); Assert.IsNotNull(setup); Assert.AreEqual(2, setup.TraceSources.Count); }
/// <inheritdoc /> public NullLogWriter(LogWriterStructureHolder structureHolder) : base(structureHolder) { }