Пример #1
0
        public void UnhandledExceptionPayloadIsCorrect()
        {
            var handledState = HandledState.ForUnhandledException();

            Assert.True((bool)handledState["unhandled"]);
            Assert.Equal("error", handledState["severity"]);
            Assert.Equal(Severity.Error, handledState.Severity);
        }
Пример #2
0
        public void CallbackSpecifiedSeverityPayloadIsCorrect()
        {
            var            originalHandledState = HandledState.ForUnhandledException();
            const Severity info         = Severity.Info;
            var            handledState = HandledState.ForCallbackSpecifiedSeverity(info, originalHandledState);

            Assert.True((bool)handledState["unhandled"]); // same as the original severity
            Assert.Equal("info", handledState["severity"]);
            Assert.Equal(info, handledState.Severity);
        }
Пример #3
0
        public void ContainsTheRequiredKeys()
        {
            var configuration = new Configuration("123456");
            var exception     = new DllNotFoundException();
            var severity      = HandledState.ForUnhandledException();
            var breadcrumbs   = new Breadcrumb[0];
            var session       = new Session();

            var @event = new Report(configuration, exception, severity, breadcrumbs, session);

            Assert.Equal(configuration.ApiKey, @event["apiKey"]);
            Assert.NotNull(@event["notifier"]);
            Assert.NotNull(@event["events"]);
        }
Пример #4
0
        public void LargePaylaodsDropBreadcrumbsAndMetadata()
        {
            var configuration = new Configuration("123456");
            var exception     = new DllNotFoundException();
            var severity      = HandledState.ForUnhandledException();
            var breadcrumbs   = new Breadcrumb[] { new Breadcrumb("wow bread!", BreadcrumbType.Manual) };
            var session       = new Session();

            var report = new Report(configuration, exception, severity, breadcrumbs, session);

            report.Event.Metadata.Add("small metadat", "so small");
            report.Event.Metadata.Add("large metadata", new String('a', (1024 * 1024)));

            var data = report.Serialize();

            Assert.NotNull(data);

            Assert.Null(report.Event.Breadcrumbs);
            Assert.Single(report.Event.Metadata);
        }