Exemplo n.º 1
0
        public void Can_Not_Add_Swagger()
        {
            var serviceCollection = new ServiceCollection();
            var apiModule         = new ApiModule(null, new List <string>(), false);

            apiModule.ConfigureServices(serviceCollection);
            serviceCollection.Any(service => service.ServiceType == typeof(ISwaggerProvider)).Should().Be(false);
        }
Exemplo n.º 2
0
        private void AssertService(Type type, bool addSwagger = true, bool shouldContain = true)
        {
            if (_apiModule == null)
            {
                _apiModule = new ApiModule(null,
                                           new List <string>(), addSwagger);
                _apiModule.ConfigureServices(_serviceCollection);
            }

            _serviceCollection.Any(service => service.ServiceType == type).Should().Be(shouldContain);
        }
Exemplo n.º 3
0
        public void Can_Add_Api()
        {
            Type[] serviceTypes =
            {
                typeof(ICorsService),
            };

            var serviceCollection = new ServiceCollection();
            var apiModule         = new ApiModule(null, new List <string>(), true);

            apiModule.ConfigureServices(serviceCollection);

            foreach (var serviceType in serviceTypes)
            {
                serviceCollection.Any(service => service.ServiceType == serviceType).Should().Be(true);
            }
        }