コード例 #1
0
        public void Init()
        {
            _mock          = new Mock <IStatsBufferizeFactory>(MockBehavior.Loose);
            _statsdBuilder = new StatsdBuilder(_mock.Object);
            _mock.Setup(m => m.CreateUnixDomainSocketTransport(
                            It.IsAny <UnixEndPoint>(),
                            It.IsAny <TimeSpan?>()))
            .Returns <UnixEndPoint, TimeSpan?>((e, d) =>
            {
                _unixEndPoint = e;
                return(new UnixDomainSocketTransport(e, d));
            });
            _unixEndPoint = null;

            _mock.Setup(m => m.CreateUDPTransport(It.IsAny <IPEndPoint>()))
            .Returns <IPEndPoint>(e =>
            {
                _ipEndPoint = e;
                return(new UDPTransport(e));
            });
            _ipEndPoint = null;

            foreach (var key in _envVarsKeyToRestore)
            {
                _envVarsToRestore[key] = Environment.GetEnvironmentVariable(key);
            }

            // Set default hostname
            Environment.SetEnvironmentVariable(StatsdConfig.DD_AGENT_HOST_ENV_VAR, "0.0.0.0");
        }
コード例 #2
0
        public void Init()
        {
            _mock          = new Mock <IStatsBufferizeFactory>(MockBehavior.Loose);
            _statsdBuilder = new StatsdBuilder(_mock.Object);

            foreach (var key in _envVarsKeyToRestore)
            {
                _envVarsToRestore[key] = Environment.GetEnvironmentVariable(key);
            }

            // Set default hostname
            Environment.SetEnvironmentVariable(StatsdConfig.DD_AGENT_HOST_ENV_VAR, "0.0.0.0");
        }