Skip to content

Commit 805df3f

Browse files
committed
Added test to ensure we copy exception data
1 parent e82b5b0 commit 805df3f

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

test/Exceptionless.Tests/Plugins/PluginTests.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,31 @@ public void ErrorPlugin_CopyExceptionDataToRootErrorData() {
498498
}
499499
}
500500

501+
[Fact]
502+
public void ErrorPlugin_CopyExceptionData() {
503+
var errorPlugins = new List<IEventPlugin> {
504+
new ErrorPlugin(),
505+
new SimpleErrorPlugin()
506+
};
507+
508+
foreach (var plugin in errorPlugins) {
509+
var exception = new Exception("Test") {
510+
Data = { { "Test", "Test" } }
511+
};
512+
513+
var client = CreateClient();
514+
var context = new EventPluginContext(client, new Event());
515+
context.ContextData.SetException(exception);
516+
plugin.Run(context);
517+
Assert.False(context.Cancel);
518+
519+
var error = context.Event.GetError() as IData ?? context.Event.GetSimpleError();
520+
Assert.NotNull(error);
521+
Assert.Single(error.Data);
522+
Assert.Equal("Test", error.Data.GetString("Test"));
523+
}
524+
}
525+
501526
[Fact]
502527
public void ErrorPlugin_IgnoredProperties() {
503528
var exception = new MyApplicationException("Test") {

0 commit comments

Comments
 (0)