public void EventExclusionPlugin_LogLevelsWithInfoDefault(string source, string level, string settingKey, string settingValue, bool cancelled) { var client = CreateClient(); client.Configuration.Settings.Add(SettingsDictionary.KnownKeys.LogLevelPrefix + "*", "Info"); if (settingKey != null) { client.Configuration.Settings.Add(settingKey, settingValue); } var ev = new Event { Type = Event.KnownTypes.Log, Source = source }; if (!String.IsNullOrEmpty(level)) { ev.SetProperty(Event.KnownDataKeys.Level, level); } var context = new EventPluginContext(client, ev); var plugin = new EventExclusionPlugin(); plugin.Run(context); Assert.Equal(cancelled, context.Cancel); }
public void EventExclusionPlugin_ExceptionType(string settingKey, bool cancelled) { var client = CreateClient(); if (settingKey != null) { client.Configuration.Settings.Add(settingKey, Boolean.FalseString); } var plugin = new EventExclusionPlugin(); var context = new EventPluginContext(client, new Event()); context.ContextData.SetException(GetException()); plugin.Run(context); Assert.Equal(cancelled, context.Cancel); context.ContextData.SetException(GetNestedSimpleException()); plugin.Run(context); Assert.Equal(cancelled, context.Cancel); }
public void EventExclusionPlugin_EventExclusions() { var client = CreateClient(); var plugin = new EventExclusionPlugin(); // ignore any event that has a value of 2 client.Configuration.AddEventExclusion(e => e.Value.GetValueOrDefault() != 2); var ev = new Event { Value = 1 }; var context = new EventPluginContext(client, ev); plugin.Run(context); Assert.False(context.Cancel); ev.Value = 2; context = new EventPluginContext(client, ev); plugin.Run(context); Assert.True(context.Cancel); }
public void EventExclusionPlugin_SourceType(string type, string source, string settingKey, string settingValue, bool cancelled) { var client = CreateClient(); if (settingKey != null) { client.Configuration.Settings.Add(settingKey, settingValue); } var ev = new Event { Type = type, Source = source }; var context = new EventPluginContext(client, ev); var plugin = new EventExclusionPlugin(); plugin.Run(context); Assert.Equal(cancelled, context.Cancel); }