예제 #1
0
        public void SetupConsulListener()
        {
            _consulSimulator = new ConsulSimulator(ConsulPort);

            _testingKernel = new TestingKernel <ConsoleLog>(k =>
            {
                _environment = Substitute.For <IEnvironment>();
                _environment.ConsulAddress.Returns($"{CurrentApplicationInfo.HostName}:{ConsulPort}");
                _environment.Zone.Returns(Zone);
                k.Rebind <IEnvironment>().ToMethod(_ => _environment);

                k.Rebind <IDateTime>().ToMethod(_ => _dateTimeFake);
            });
        }
예제 #2
0
        public void SetupConsulListener()
        {
            _consulSimulator = new ConsulSimulator(ConsulPort);

            _testingKernel = new TestingKernel <ConsoleLog>(k =>
            {
                _environmentVariableProvider = Substitute.For <IEnvironmentVariableProvider>();
                _environmentVariableProvider.ConsulAddress.Returns($"{CurrentApplicationInfo.HostName}:{ConsulPort}");
                _environmentVariableProvider.DataCenter.Returns(DataCenter);
                k.Rebind <IEnvironmentVariableProvider>().ToMethod(_ => _environmentVariableProvider);

                k.Rebind <IDateTime>().ToMethod(_ => _dateTimeFake);

                k.Rebind <Func <ConsulConfig> >().ToMethod(_ => () => _consulConfig);
            });
        }