public void Gateway_Ignores_LocalTypes()
        {
            var gateway = new ConsulServiceGatewayFactory(uri => new CsvServiceClient(uri), new TestServiceDiscovery());
            gateway.LocalTypes.Add(typeof(ConsulServiceGatewayFactoryTests));

            var serviceGateway = gateway.GetGateway(typeof(ConsulServiceGatewayFactoryTests));

            serviceGateway.Should().BeNull();
        }
Example #2
0
        public void Gateway_Ignores_LocalTypes()
        {
            var gateway = new ConsulServiceGatewayFactory(uri => new CsvServiceClient(uri), new TestServiceDiscovery());

            gateway.LocalTypes.Add(typeof(ConsulServiceGatewayFactoryTests));

            var serviceGateway = gateway.GetGateway(typeof(ConsulServiceGatewayFactoryTests));

            serviceGateway.Should().BeNull();
        }
        public void Gateway_ReturnsCorrectly_ForNonLocalTypes()
        {
            var resolver = new TestServiceDiscovery(new KeyValuePair<Type, string>(typeof(ConsulServiceGatewayFactoryTests), "http://banana"));
            var gateway = new ConsulServiceGatewayFactory(uri => new CsvServiceClient(uri) { Version = 123 }, resolver);
            gateway.LocalTypes.Clear();

            var serviceGateway = gateway.GetGateway(typeof(ConsulServiceGatewayFactoryTests));

            var client = serviceGateway.Should().BeOfType<CachedServiceClient>().Subject;
            client.Version.Should().Be(123);
        }
Example #4
0
        public void Gateway_ReturnsCorrectly_ForNonLocalTypes()
        {
            var resolver = new TestServiceDiscovery(new KeyValuePair <Type, string>(typeof(ConsulServiceGatewayFactoryTests), "http://banana"));
            var gateway  = new ConsulServiceGatewayFactory(uri => new CsvServiceClient(uri)
            {
                Version = 123
            }, resolver);

            gateway.LocalTypes.Clear();

            var serviceGateway = gateway.GetGateway(typeof(ConsulServiceGatewayFactoryTests));

            var client = serviceGateway.Should().BeOfType <CachedServiceClient>().Subject;

            client.Version.Should().Be(123);
        }