public TestShoppingServiceApi()
        {
            var environment   = Environment.GetEnvironmentVariable("SHOPPING_SERVICE_ENVIRONMENT");
            var configuration = AppConfigurationBuilder.Initialize(
                Directory.GetCurrentDirectory(),
                $"settings.{environment}.json"
                ).Build();

            var dbConnectionString = Environment.GetEnvironmentVariable("SHOPPING_SERVICE_DB_CONNECTION_STRING");
            var webHostBuilder     = WebApplicationBuilderFactory.Initialize(configuration, dbConnectionString);

            _server = new TestServer(webHostBuilder);
        }
Esempio n. 2
0
        public static void Main(string[] args)
        {
            var environment   = Environment.GetEnvironmentVariable("SHOPPING_SERVICE_ENVIRONMENT");
            var configuration = AppConfigurationBuilder.Initialize(
                Path.GetDirectoryName(Assembly.GetEntryAssembly().Location),
                $"settings.{environment}.json"
                ).Build();

            var dbConnectionString = Environment.GetEnvironmentVariable("SHOPPING_SERVICE_DB_CONNECTION_STRING");

            WebApplicationBuilderFactory
            .Initialize(configuration, dbConnectionString)
            .Build()
            .Run();
        }