public void AddDefaultActivators_Executes_Once()
        {
            var services = new ServiceCollection();
            var builder  = new GenericSearchServicesBuilder(services);

            builder.AddDefaultActivators();

            var count = services.Count;

            builder.AddDefaultActivators();

            services.Count.Should().Be(count);
        }
            public AddDefaultActivators()
            {
                var services = new ServiceCollection();
                var builder  = new GenericSearchServicesBuilder(services);

                builder.AddDefaultActivators();
                provider = services.BuildServiceProvider().CreateScope().ServiceProvider;
            }
        public void AddRequestFactory_Succeeds()
        {
            var services = new ServiceCollection();
            var builder  = new GenericSearchServicesBuilder(services);

            builder.AddDefaultActivators()
            .AddDefaultServices();
            builder.AddModelFactory <TestModelFactory>();

            var provider = services.BuildServiceProvider();

            var requestFactory = provider.CreateScope().ServiceProvider.GetRequiredService <IModelFactory>();

            requestFactory.Should().BeOfType <TestModelFactory>();
        }
        public void AddList_Succeeds()
        {
            var services = new ServiceCollection();
            var builder  = new GenericSearchServicesBuilder(services);

            builder.AddDefaultActivators()
            .AddDefaultServices();
            builder.AddList <Request, Item, Result>();

            var provider = services.BuildServiceProvider();

            var configurationProvider =
                provider.CreateScope().ServiceProvider.GetRequiredService <IListConfigurationProvider>();

            var configuration = configurationProvider.GetConfiguration(typeof(Request));

            configuration.Should().NotBeNull();
            configuration.ItemType.Should().Be <Item>();
            configuration.ResultType.Should().Be <Result>();
        }