public void ProcessEvent_WithCorrectlyConfiguredProviderWithNoProviderSet_LogsToDefaultProvider() { using (var scope = new LoggingProviderScope(ScopeOption.AllowOnlyASingleEntryToBeLogged)) { // Arrange var provider = CreateInitializedProvider(); WebBaseEvent webEvent = new DerivedWebErrorEvent("Valid message", null, 1, new Exception()); // Act provider.ProcessEvent(webEvent); // Assert Assert.AreEqual(1, scope.LoggedEntries.Count); } }
public void ProcessEvent_WithDerivedWebErrorEvent_LogsExpectedEntry() { using (var scope = new LoggingProviderScope(ScopeOption.AllowOnlyASingleEntryToBeLogged)) { // Arrange var expectedSeverity = LoggingEventType.Error; var provider = CreateInitializedProvider(); WebBaseEvent webEvent = new DerivedWebErrorEvent("Valid message", null, 1, new Exception()); // Act provider.ProcessEvent(webEvent); // Assert var loggedEntry = scope.LoggedEntries.First(); Assert.AreEqual(expectedSeverity, loggedEntry.Severity); Assert.IsNotNull(loggedEntry.Exception); } }
public void ProcessEvent_WithCorrectlyConfiguredProviderWithProviderSet_LogsToExpectedProvider() { using (var scope = new LoggingProviderScope(ScopeOption.AllowOnlyASingleEntryToBeLogged)) { // Arrange var provider = new LoggingWebEventProvider(); var configuration = new NameValueCollection(); configuration.Add("loggingProvider", "UnitTestingLoggingProvider"); provider.Initialize("Valid name", configuration); WebBaseEvent webEvent = new DerivedWebErrorEvent("Valid message", null, 1, new Exception()); // Act provider.ProcessEvent(webEvent); // Assert Assert.AreEqual(1, scope.LoggedEntries.Count); } }