public void WhenFilterIsSetThenRenderedMessageIsFirstPassedThroughRenderedMessageFilter() { _appender.RenderedMessageFilter = typeof(FakeMessageFilter).AssemblyQualifiedName; var errorLoggingEvent = new LoggingEvent(GetType(), null, GetType().Name, Level.Error, new TestException(), null); _appender.DoAppend(errorLoggingEvent); Assert.That(_fakeRaygunClient.LastMessageSent.Details.UserCustomData[UserCustomDataBuilder.UserCustomDataKey.RenderedMessage], Is.EqualTo(FakeMessageFilter.ReplacementMessage)); }
public void WhenFilterIsSetThenExceptionsAreFirstPassedThroughTheExceptionFilter() { _appender.ExceptionFilter = typeof(FakeMessageFilter).AssemblyQualifiedName; var errorLoggingEvent = new LoggingEvent(GetType(), null, GetType().Name, Level.Error, new NullReferenceException(), null); _appender.DoAppend(errorLoggingEvent); Assert.That(_fakeRaygunClient.LastMessageSent.Details.Error.ClassName, Is.EqualTo("System.NullReferenceException")); Assert.That(_fakeRaygunClient.LastMessageSent.Details.Error.Message, Is.EqualTo("I changed your message!")); }
public void WhenLoggingEventContainsAnExceptionThenSendRaygunMessage(Level loggingLevel) { var loggingEvent = new LoggingEvent(GetType(), null, GetType().Name, loggingLevel, null, new TestException()); _appender.DoAppend(loggingEvent); Assert.That(_fakeRaygunClient.LastMessageSent, Is.Not.Null); }
public void WhenLoggingEventContainsTagsThenRaygunMessageIsBuiltWithTags() { var loggingEventWithProperties = new LoggingEvent(new LoggingEventData { Properties = new PropertiesDictionary() }); const string tags = "tag1|tag2|tag3"; loggingEventWithProperties.Properties[RaygunAppenderBase.PropertyKeys.Tags] = tags; _appender.DoAppend(loggingEventWithProperties); Assert.That(_fakeRaygunClient.LastMessageSent.Details.Tags, Is.EquivalentTo(tags.Split('|').ToList())); }
public void WhenLoggingEventContainsAffectedUserInformationThenRaygunMessageIsBuiltWithRaygunIdentifier() { var loggingEventWithProperties = new LoggingEvent(new LoggingEventData { Properties = new PropertiesDictionary() }); var affectedUserInfo = new RaygunIdentifierMessage("I am an affected user"); loggingEventWithProperties.Properties[RaygunAppenderBase.PropertyKeys.AffectedUser] = affectedUserInfo; _appender.DoAppend(loggingEventWithProperties); Assert.That(_fakeRaygunClient.LastMessageSent.Details.User, Is.EqualTo(affectedUserInfo)); }
public void WhenNoApiKeyIsConfiguredInTheAppenderThenThatIsLogged() { var errorLoggingEvent = new LoggingEvent(GetType(), null, GetType().Name, Level.Error, null, new TestException()); _appender.DoAppend(errorLoggingEvent); Assert.That(_fakeErrorHandler.Errors, Has.Exactly(1).EqualTo("RaygunAppender: API Key is empty")); }
private void UseACustomRaygunClientFactory(IRaygunClientFactory raygunClientFactory) { const string customRaygunFactoryType = "CustomRaygunClientFactoryType"; _fakeTypeActivator.FakedType = new KeyValuePair <string, object>(customRaygunFactoryType, raygunClientFactory); _appender.CustomRaygunClientFactory = customRaygunFactoryType; var errorLoggingEvent = new LoggingEvent(GetType(), null, GetType().Name, Level.Error, new TestException(), null); _appender.DoAppend(errorLoggingEvent); }