public void RequestCompletedLogEntry() { var server = new TestServerBuilder() .AddGraphType <LogTestController>() .Build(); var builder = server.CreateQueryContextBuilder(); builder.AddQueryText("{ testField }"); var request = builder.OperationRequest; var context = builder.Build(); var mock = new Mock <IGraphOperationResult>(); mock.Setup(x => x.Request).Returns(request); mock.Setup(x => x.Data).Returns(new ResponseFieldSet()); mock.Setup(x => x.Messages).Returns(new GraphMessageCollection()); context.Result = mock.Object; var entry = new RequestCompletedLogEntry(context); Assert.AreEqual(LogEventIds.RequestCompleted.Id, entry.EventId); Assert.AreEqual(request.Id, entry.OperationRequestId); Assert.AreEqual(false, entry.ResultHasErrors); Assert.AreEqual(true, entry.ResultHasData); Assert.IsNotNull(entry.ToString()); }
/// <inheritdoc /> public virtual void RequestCompleted(GraphQueryExecutionContext queryContext) { if (!this.IsEnabled(LogLevel.Debug)) { return; } var entry = new RequestCompletedLogEntry(queryContext); this.LogEvent(LogLevel.Trace, entry); }