Exemple #1
0
        public void Descriptor_ThrowsIfReplacedServiceCanotBeFound(DescribeAction action, LifecycleKind lifeCycle)
        {
            // Arrange
            var expected      = Resources.FormatCannotLocateImplementation("Type-Does-NotExist", typeof(IFakeService).FullName);
            var configuration = new Configuration();

            configuration.Add(new MemoryConfigurationSource());
            configuration.Set(typeof(IFakeService).FullName, "Type-Does-NotExist");
            var serviceDescriber = new ServiceDescriber(configuration);

            // Act and Assert
            var ex = Assert.Throws <InvalidOperationException>(() => action(serviceDescriber));

            Assert.Equal(expected, ex.Message);
        }
Exemple #2
0
        public void Descriptor_ReplacesServicesFromConfiguration(DescribeAction action, LifecycleKind lifeCycle)
        {
            // Arrange
            var configuration = new Configuration();

            configuration.Add(new MemoryConfigurationSource());
            configuration.Set(typeof(IFakeService).FullName, typeof(FakeOuterService).AssemblyQualifiedName);
            var serviceDescriber = new ServiceDescriber(configuration);

            // Act
            var descriptor = action(serviceDescriber);

            // Assert
            Assert.Equal(typeof(IFakeService), descriptor.ServiceType);
            Assert.Equal(typeof(FakeOuterService), descriptor.ImplementationType);
            Assert.Equal(lifeCycle, descriptor.Lifecycle);
            Assert.Null(descriptor.ImplementationFactory);
            Assert.Null(descriptor.ImplementationInstance);
        }
Exemple #3
0
 public QueryService(ConfigService configService, RegistryService registryService, ClientFactory clientFactory, UnknownAction unknownAction, DescribeAction describeAction, CommandAction commandAction, QueryAction queryAction)
 {
     this.config         = configService ?? throw new ArgumentNullException(nameof(configService));
     this.registry       = registryService ?? throw new ArgumentNullException(nameof(registryService));
     this.clients        = clientFactory ?? throw new ArgumentNullException(nameof(clientFactory));
     this.unknownAction  = unknownAction ?? throw new ArgumentNullException(nameof(unknownAction));
     this.describeAction = describeAction ?? throw new ArgumentNullException(nameof(describeAction));
     this.commandAction  = commandAction ?? throw new ArgumentNullException(nameof(commandAction));
     this.queryAction    = queryAction ?? throw new ArgumentNullException(nameof(queryAction));
 }