public void HandleAggregateExceptionsPlugin_SingleInnerException()
        {
            var client = CreateClient();
            var plugin = new HandleAggregateExceptionsPlugin();

            var exceptionOne = new Exception("one");
            var exceptionTwo = new Exception("two");

            var context = new EventPluginContext(client, new Event());

            context.ContextData.SetException(exceptionOne);
            plugin.Run(context);
            Assert.False(context.Cancel);

            context = new EventPluginContext(client, new Event());
            context.ContextData.SetException(new AggregateException(exceptionOne));
            plugin.Run(context);
            Assert.False(context.Cancel);
            Assert.Equal(exceptionOne, context.ContextData.GetException());

            context = new EventPluginContext(client, new Event());
            context.ContextData.SetException(new AggregateException(exceptionOne, exceptionTwo));
            plugin.Run(context);
            Assert.True(context.Cancel);
        }
        public void HandleAggregateExceptionsPlugin_MultipleInnerException()
        {
            var submissionClient = new InMemorySubmissionClient();
            var client           = new ExceptionlessClient("LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw");

            client.Configuration.Resolver.Register <ISubmissionClient>(submissionClient);

            var plugin       = new HandleAggregateExceptionsPlugin();
            var exceptionOne = new Exception("one");
            var exceptionTwo = new Exception("two");

            var context = new EventPluginContext(client, new Event());

            context.ContextData.SetException(new AggregateException(exceptionOne, exceptionTwo));
            plugin.Run(context);
            Assert.True(context.Cancel);

            client.ProcessQueue();
            Assert.Equal(2, submissionClient.Events.Count);
        }
        public void HandleAggregateExceptionsPlugin_SingleInnerException() {
            var client = new ExceptionlessClient();
            var plugin = new HandleAggregateExceptionsPlugin();
            
            var exceptionOne = new Exception("one");
            var exceptionTwo = new Exception("two");

            var context = new EventPluginContext(client, new Event());
            context.ContextData.SetException(exceptionOne);
            plugin.Run(context);
            Assert.False(context.Cancel);
            
            context = new EventPluginContext(client, new Event());
            context.ContextData.SetException(new AggregateException(exceptionOne));
            plugin.Run(context);
            Assert.False(context.Cancel);
            Assert.Equal(exceptionOne, context.ContextData.GetException());

            context = new EventPluginContext(client, new Event());
            context.ContextData.SetException(new AggregateException(exceptionOne, exceptionTwo));
            plugin.Run(context);
            Assert.False(context.Cancel);
            Assert.Equal(exceptionOne, context.ContextData.GetException());
        }
        public void HandleAggregateExceptionsPlugin_MultipleInnerException() {
            var submissionClient = new InMemorySubmissionClient();
            var client = new ExceptionlessClient("LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw");
            client.Configuration.Resolver.Register<ISubmissionClient>(submissionClient);
            
            var plugin = new HandleAggregateExceptionsPlugin();
            var exceptionOne = new Exception("one");
            var exceptionTwo = new Exception("two");
            
            var context = new EventPluginContext(client, new Event());
            context.ContextData.SetException(new AggregateException(exceptionOne, exceptionTwo));
            plugin.Run(context);
            Assert.True(context.Cancel);

            client.ProcessQueue();
            Assert.Equal(2, submissionClient.Events.Count);
        }