Пример #1
0
        public ServiceLogFactory(IMachineNameReader machineNameReader,
                                 IIpAddressReader addressIpReader)
        {
            MachineNameReader = machineNameReader
                                ?? throw new ArgumentNullException(nameof(machineNameReader));

            AddressIpReader = addressIpReader
                              ?? throw new ArgumentNullException(nameof(addressIpReader));
        }
Пример #2
0
        public ClientLogFactory(IHttpContextAccessor httpContextAccessor,
                                ITrafficCometMiddlewaresAccessor trafficCometAccessor, IIpAddressReader addressIpReader)
        {
            HttpContextAccessor = httpContextAccessor
                                  ?? throw new ArgumentNullException(nameof(httpContextAccessor));

            TrafficCometAccessor = trafficCometAccessor
                                   ?? throw new ArgumentNullException(nameof(trafficCometAccessor));

            AddressIpReader = addressIpReader
                              ?? throw new ArgumentNullException(nameof(addressIpReader));
        }
Пример #3
0
        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));
        }