コード例 #1
0
        public void TestGetEnumerator()
        {
            TestActivateLogging();

            Logger logger = (Logger)_module.Logger;

            IModuleLogger child1      = logger.GetChild("MyChildLogger");
            IModuleLogger child2      = logger.GetChild("MyChildLogger", typeof(Object));
            IModuleLogger child3      = logger.GetChild("MyOtherChildLogger");
            IModuleLogger child4      = logger.GetChild("MyOtherChildLogger", typeof(Object));
            IModuleLogger grandchild1 = child1.GetChild("MyGrandChildLogger", typeof(Object));
            IModuleLogger grandchild2 = child1.GetChild("MyOtherGrandChildLogger", typeof(Object));

            Assert.AreEqual(1, _loggerManagement.Count(), "Number of main loggers");
            Assert.AreEqual(2, logger.Count(), "Number of children");
            Assert.AreEqual(2, child1.Count(), "First number of grandchildren");
            Assert.AreEqual(0, child3.Count(), "Second number of grandchildren");
        }
コード例 #2
0
        public ConfiguredServiceHost(ITypedHostFactory factory, IModuleLogger parentLogger, EndpointCollector endpointCollector, PortConfig portConfig)
        {
            _factory    = factory;
            _collector  = endpointCollector;
            _portConfig = portConfig;

            if (parentLogger != null)
            {
                _logger = parentLogger.GetChild("WcfHosting", GetType());
            }
        }
コード例 #3
0
        private void ClientConnected(IAsyncResult ar)
        {
            TcpClient client;

            try
            {
                client = _tcpListener.EndAcceptTcpClient(ar);
            }
            catch (Exception)
            {
                return;
            }

            // Create new transmission and try to assign
            var tcpTransmission = new TcpTransmission(client, _protocolInterpreter, _logger.GetChild(string.Empty, typeof(TcpTransmission)));

            lock (_listeners)
            {
                if (_listeners.Count == 1 && !_listeners[0].ValidateBeforeAssignment)
                {
                    // If we have only one listenere we can assign directly
                    var listener = _listeners[0];
                    RemoveListener(listener);
                    listener.AssignConnection(tcpTransmission);
                }
                else
                {
                    // Wait for the first message to assign the connection
                    tcpTransmission.Disconnected += TransmissionDisconnected;
                    tcpTransmission.Received     += InitialReceive;
                }


                // If we have listners without a connection keep accepting clients
                if (_listeners.Count > 0)
                {
                    _tcpListener.BeginAcceptTcpClient(ClientConnected, null);
                }
            }
            tcpTransmission.StartReading();
        }
コード例 #4
0
 /// <inheritdoc />
 public ProductServiceModel(string host, int port, IProxyConfig proxyConfig, IModuleLogger logger)
     : base(host, port, proxyConfig, logger.GetChild(nameof(ProductServiceModel), typeof(ProductServiceModel)))
 {
 }
コード例 #5
0
 /// <inheritdoc />
 public ProductServiceModel(IWcfClientFactory clientFactory, IModuleLogger logger)
     : base(clientFactory, logger.GetChild(nameof(ProductServiceModel), typeof(ProductServiceModel)))
 {
 }