internal static IResponseLogFactory CreateMOckObject(IResponseLog responseLog) { var mockObject = new Mock <IResponseLogFactory>(); mockObject.Setup(x => x.Create(It.IsAny <string>())).Returns(responseLog); return(mockObject.Object); }
protected virtual WebEventResponseDocument CreateResponseDocument(IResponseLog trafficLogResponse) { if (trafficLogResponse == null) { throw new ArgumentNullException(nameof(trafficLogResponse)); } return(new WebEventResponseDocument { CustomParams = trafficLogResponse.CustomParams.ToDocuments(), Headers = trafficLogResponse.Headers.ToDocuments(), Status = trafficLogResponse.Status }); }
public ITrafficLog Create() { IRequestLog requestLog = null; if (!TrafficCometMiddlewaresAccessor.IgnoreRequest) { requestLog = RequestLogFactory.Create(TrafficCometMiddlewaresAccessor.RequestBody); if (requestLog == null) { throw new NullReferenceException(nameof(requestLog)); } } IResponseLog responseLog = null; if (!TrafficCometMiddlewaresAccessor.IgnoreResponse) { responseLog = ResponseLogFactory.Create(TrafficCometMiddlewaresAccessor.ResponseBody); if (responseLog == null) { throw new NullReferenceException(nameof(responseLog)); } } return(new TrafficCometLog { TraceId = TrafficCometMiddlewaresAccessor.TraceId, ApplicationId = TrafficCometMiddlewaresAccessor.ApplicationId, Server = ServerLogFactory.Create(), Dates = DatesTrafficFactory.Create(), Client = ClientLogFactory.Create(), Request = requestLog, Response = responseLog, CustomParams = TrafficCometMiddlewaresAccessor.CustomParams, }); }
/// <summary> /// Initializes a new instance of the <see cref="LogCompletion" /> class. /// </summary> /// <param name="components">The component context.</param> public LogCompletion(IComponentContext components) { _actions = components.Resolve <IResponseLog>(); _logger = components.Resolve <ILogger>(); _environmentContext = components.Resolve <ApplicationInformation>(); }
internal static TrafficLogFactory CreateTrafficLog(IRequestLog requestLog = null, IResponseLog responseLog = null, IRequestLogFactory requestLogFactory = null, IResponseLogFactory responseLogFactory = null, IIpAddressReader ipAddressReader = null, IMachineNameReader machineNameReader = null, IDatesTrafficFactory datesTrafficFactory = null, IClientLogFactory clientLogFactory = null, IServerLogFactory serverLogFactory = null) { if (requestLog == null) { requestLog = IRequestLogMockFactory.CreateMockObject(MockStaticData.RequestPath, MockStaticData.RequestBody, MockStaticData.HttpMethodGet); } if (requestLogFactory == null) { requestLogFactory = IRequestLogFactoryMockFactory.CreateMockObject(requestLog); } if (responseLog == null) { responseLog = IResponseLogMockFactory.CreateMockObject(MockStaticData.ResponseBody, 200); } if (responseLogFactory == null) { responseLogFactory = IResponseLogFactoryMockFactory.CreateMOckObject(responseLog); } if (machineNameReader == null) { machineNameReader = IMachineNameReaderMockFactory.CreateMockObject(MockStaticData.MachineName); } if (ipAddressReader == null) { ipAddressReader = IIpAddressReaderMockFactory.CreateMockObject($"{MockStaticData.IPAddress1}:{MockStaticData.Port1}", $"{MockStaticData.IPAddress2}:{MockStaticData.Port2}"); } return(new TrafficLogFactory(requestLogFactory, responseLogFactory, datesTrafficFactory, clientLogFactory, serverLogFactory, null)); }
public GetResponses(IResponseLog source) { _source = source; }
/// <summary> /// Initializes a new instance of the <see cref="GetResponses" /> class. /// </summary> /// <param name="source">The source.</param> public GetResponses(IResponseLog source) { Argument.NotNull(source, nameof(source)); _source = source; }