コード例 #1
0
        public void Given_Configuration_When_GetCityServiceInvoked_Then_ICityServiceRetrived()
        {
            var configuration = new InternalConfiguration(StaticDataConfigurationBuilder.Generate().SetApiPreferably(false));
            var service       = StaticDataServiceFactory.GetCityService(configuration);

            Assert.IsNotNull(service);
            Assert.AreEqual(typeof(CityService), service.GetType());
        }
コード例 #2
0
        private static void RegisterServicesSingleton(IServiceCollection services, InternalConfiguration configurationBase)
        {
            services.AddSingleton(configurationBase);

            services.AddSingleton(StaticDataServiceFactory.GetCityService(configurationBase));
            services.AddSingleton(StaticDataServiceFactory.GetCountryService(configurationBase));
            services.AddSingleton(StaticDataServiceFactory.GetCurrencyService(configurationBase));
            services.AddSingleton(StaticDataServiceFactory.GetExchangeRateService(configurationBase));
        }