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); }
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); }
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(); }
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(); }