public void DiscoverInjectables_Adds_Resource_Repositories_From_Current_Assembly_To_Container()
        {
            // Arrange
            ServiceDiscoveryFacade facade = new ServiceDiscoveryFacade(_services, _resourceGraphBuilder, _options, _loggerFactory);

            facade.AddCurrentAssembly();

            // Act
            facade.DiscoverInjectables();

            // Assert
            var services = _services.BuildServiceProvider();

            Assert.IsType <TestModelRepository>(services.GetRequiredService <IResourceRepository <TestModel> >());
        }
Beispiel #2
0
        public void AddCurrentAssembly_Adds_Resource_Definitions_From_Current_Assembly_To_Container()
        {
            // Arrange
            ServiceDiscoveryFacade facade = new ServiceDiscoveryFacade(_services, _resourceGraphBuilder, NullLoggerFactory.Instance);

            facade.AddCurrentAssembly();

            // Act
            facade.DiscoverInjectables();

            // Assert
            var services = _services.BuildServiceProvider();

            Assert.IsType <TestModelResourceDefinition>(services.GetService <ResourceDefinition <TestModel> >());
        }
        public void AddCurrentAssembly_Adds_Resource_Hooks_Definitions_From_Current_Assembly_To_Container()
        {
            // Arrange
            ServiceDiscoveryFacade facade = new ServiceDiscoveryFacade(_services, _resourceGraphBuilder, _options, _loggerFactory);

            facade.AddCurrentAssembly();

            _options.EnableResourceHooks = true;

            // Act
            facade.DiscoverInjectables();

            // Assert
            var services = _services.BuildServiceProvider();

            Assert.IsType <TestModelResourceHooksDefinition>(services.GetRequiredService <ResourceHooksDefinition <TestModel> >());
        }
        public void Can_add_resource_service_from_current_assembly_to_container()
        {
            // Arrange
            var facade = new ServiceDiscoveryFacade(_services, _resourceGraphBuilder, _options, _loggerFactory);

            facade.AddCurrentAssembly();

            // Act
            facade.DiscoverInjectables();

            // Assert
            var services = _services.BuildServiceProvider();

            var resourceService = services.GetRequiredService <IResourceService <TestResource> >();

            resourceService.Should().BeOfType <TestResourceService>();
        }
Beispiel #5
0
        public void Can_add_resource_hooks_definition_from_current_assembly_to_container()
        {
            // Arrange
            var facade = new ServiceDiscoveryFacade(_services, _resourceGraphBuilder, _options, LoggerFactory);

            facade.AddCurrentAssembly();

            _options.EnableResourceHooks = true;

            // Act
            facade.DiscoverInjectables();

            // Assert
            var services = _services.BuildServiceProvider();

            var resourceHooksDefinition = services.GetRequiredService <ResourceHooksDefinition <TestResource> >();

            resourceHooksDefinition.Should().BeOfType <TestResourceHooksDefinition>();
        }