public async Task LogAsync()
        {
            var options = ErrorReportingOptions.Create(
                EventTarget.ForLogging("pid", loggingClient: new ThrowingLoggingClient()));
            var consumer = new FakeConsumer();

            IContextExceptionLogger logger = new ErrorReportingContextExceptionLogger(
                consumer, _service, _version, options, null);
            await logger.LogAsync(CreateException(), new FakeContextWrapper());

            ValidateSingleEntry(consumer, _method, _uri, _userAgent, options);
        }
示例#2
0
        public async Task LogAsync()
        {
            var eventTarget = EventTarget.ForProject("pid");
            var options     = ErrorReportingOptions.CreateInstance();
            var consumer    = new FakeConsumer();

            IContextExceptionLogger logger = new ErrorReportingContextExceptionLogger(
                consumer, eventTarget, _serviceContext, options, null);
            await logger.LogAsync(CreateException(), new FakeContextWrapper());

            ValidateSingleEntry(consumer, _method, _uri, _userAgent, options, eventTarget);
        }
示例#3
0
        public async Task LogAsync()
        {
            var mockConsumer = new Mock <IConsumer <ReportedErrorEvent> >();

            mockConsumer.Setup(c => c.ReceiveAsync(
                                   IsContext(_method, _uri, _userAgent, _statusCode), It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult(true));

            IContextExceptionLogger logger =
                new ErrorReportingContextExceptionLogger(mockConsumer.Object, _service, _version);

            await logger.LogAsync(CreateException(), new FakeContextWrapper());

            mockConsumer.VerifyAll();
        }
示例#4
0
        public async Task LogAsync()
        {
            var options = ErrorReportingOptions.Create(
                EventTarget.ForLogging("pid", loggingClient: new Mock <LoggingServiceV2Client>().Object));
            var mockConsumer = new Mock <IConsumer <LogEntry> >();

            mockConsumer.Setup(c => c.ReceiveAsync(
                                   IsContext(_method, _uri, _userAgent, options), It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult(true));

            IContextExceptionLogger logger = new ErrorReportingContextExceptionLogger(
                mockConsumer.Object, _service, _version, options);

            await logger.LogAsync(CreateException(), new FakeContextWrapper());

            mockConsumer.VerifyAll();
        }