Fix integration tests
This commit is contained in:
parent
a87efdef32
commit
3858d7ccf7
@ -45,7 +45,7 @@ public class BasketScenarioBase
|
||||
{
|
||||
var directory = Path.GetDirectoryName(typeof(BasketScenarioBase).Assembly.Location)!;
|
||||
|
||||
c.AddJsonFile(Path.Combine(directory, "appsettings.json"), optional: false);
|
||||
c.AddJsonFile(Path.Combine(directory, "appsettings.Basket.json"), optional: false);
|
||||
});
|
||||
|
||||
return base.CreateHost(builder);
|
||||
|
@ -7,7 +7,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="appsettings.json">
|
||||
<Content Include="appsettings.Basket.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
@ -7,7 +7,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="appsettings.json" />
|
||||
<None Remove="appsettings.Catalog.json" />
|
||||
<None Remove="Setup\CatalogBrands.csv" />
|
||||
<None Remove="Setup\CatalogItems.csv" />
|
||||
<None Remove="Setup\CatalogItems.zip" />
|
||||
@ -15,7 +15,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="appsettings.json">
|
||||
<Content Include="appsettings.Catalog.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Setup\CatalogBrands.csv">
|
||||
|
@ -1,15 +1,10 @@
|
||||
using Microsoft.AspNetCore.Mvc.Testing;
|
||||
using System;
|
||||
using Microsoft.AspNetCore.Mvc.Testing;
|
||||
|
||||
namespace Catalog.FunctionalTests;
|
||||
|
||||
public class CatalogScenariosBase
|
||||
{
|
||||
public TestServer CreateServer()
|
||||
{
|
||||
var factory = new CatalogApplication();
|
||||
return factory.Server;
|
||||
}
|
||||
|
||||
private class CatalogApplication : WebApplicationFactory<Program>
|
||||
{
|
||||
protected override IHost CreateHost(IHostBuilder builder)
|
||||
@ -18,13 +13,19 @@ public class CatalogScenariosBase
|
||||
{
|
||||
var directory = Path.GetDirectoryName(typeof(CatalogScenariosBase).Assembly.Location)!;
|
||||
|
||||
c.AddJsonFile(Path.Combine(directory, "appsettings.json"), optional: false);
|
||||
c.AddJsonFile(Path.Combine(directory, "appsettings.Catalog.json"), optional: false);
|
||||
});
|
||||
|
||||
return base.CreateHost(builder);
|
||||
}
|
||||
}
|
||||
|
||||
public TestServer CreateServer()
|
||||
{
|
||||
var factory = new CatalogApplication();
|
||||
return factory.Server;
|
||||
}
|
||||
|
||||
public static class Get
|
||||
{
|
||||
private const int PageIndex = 0;
|
||||
|
@ -4,7 +4,7 @@
|
||||
"PicBaseUrl": "http://localhost:5101/api/v1/catalog/items/[0]/pic/",
|
||||
|
||||
"ConnectionStrings": {
|
||||
"CatalogDb": "Server=tcp:127.0.0.1,5433;Initial Catalog=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word;Encrypt=False;TrustServerCertificate=true"
|
||||
"CatalogDB": "Server=tcp:127.0.0.1,5433;Initial Catalog=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word;Encrypt=False;TrustServerCertificate=true"
|
||||
},
|
||||
|
||||
"EventBus": {
|
@ -5,7 +5,7 @@ builder.AddServiceDefaults();
|
||||
builder.Services.AddControllersWithViews();
|
||||
|
||||
builder.Services.AddDbContext<ApplicationDbContext>(options =>
|
||||
options.UseSqlServer(builder.Configuration.GetConnectionString("IdentityDb")));
|
||||
options.UseSqlServer(builder.Configuration.GetConnectionString("IdentityDB")));
|
||||
|
||||
builder.Services.AddIdentity<ApplicationUser, IdentityRole>()
|
||||
.AddEntityFrameworkStores<ApplicationDbContext>()
|
||||
@ -30,7 +30,7 @@ builder.Services.AddIdentityServer(options =>
|
||||
|
||||
builder.Services.AddHealthChecks()
|
||||
.AddSqlServer(_ =>
|
||||
builder.Configuration.GetRequiredConnectionString("IdentityDb"),
|
||||
builder.Configuration.GetRequiredConnectionString("IdentityDB"),
|
||||
name: "IdentityDB-check",
|
||||
tags: new string[] { "IdentityDB" });
|
||||
|
||||
|
@ -7,7 +7,7 @@ public static class CustomExtensionMethods
|
||||
var hcBuilder = services.AddHealthChecks();
|
||||
|
||||
hcBuilder.AddSqlServer(_ =>
|
||||
configuration.GetRequiredConnectionString("OrderingDb"),
|
||||
configuration.GetRequiredConnectionString("OrderingDB"),
|
||||
name: "OrderingTaskDB-check",
|
||||
tags: new string[] { "live", "ready" });
|
||||
|
||||
@ -19,7 +19,7 @@ public static class CustomExtensionMethods
|
||||
return services.Configure<BackgroundTaskSettings>(configuration)
|
||||
.Configure<BackgroundTaskSettings>(o =>
|
||||
{
|
||||
o.ConnectionString = configuration.GetRequiredConnectionString("OrderingDb");
|
||||
o.ConnectionString = configuration.GetRequiredConnectionString("OrderingDB");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="appsettings.json">
|
||||
<Content Include="appsettings.Ordering.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
@ -14,16 +14,16 @@ public class OrderingScenarioBase
|
||||
|
||||
protected override IHost CreateHost(IHostBuilder builder)
|
||||
{
|
||||
builder.ConfigureServices(servies =>
|
||||
builder.ConfigureServices(services =>
|
||||
{
|
||||
servies.AddSingleton<IStartupFilter, AuthStartupFilter>();
|
||||
services.AddSingleton<IStartupFilter, AuthStartupFilter>();
|
||||
});
|
||||
|
||||
builder.ConfigureAppConfiguration(c =>
|
||||
{
|
||||
var directory = Path.GetDirectoryName(typeof(OrderingScenarioBase).Assembly.Location)!;
|
||||
|
||||
c.AddJsonFile(Path.Combine(directory, "appsettings.json"), optional: false);
|
||||
c.AddJsonFile(Path.Combine(directory, "appsettings.Ordering.json"), optional: false);
|
||||
});
|
||||
|
||||
return base.CreateHost(builder);
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"ConnectionStrings": {
|
||||
"OrderingDb": "Server=tcp:127.0.0.1,5433;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word;Encrypt=False;TrustServerCertificate=true",
|
||||
"OrderingDB": "Server=tcp:127.0.0.1,5433;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word;Encrypt=False;TrustServerCertificate=true",
|
||||
"EventBus": "localhost"
|
||||
},
|
||||
"CheckUpdateTime": "30000",
|
@ -4,7 +4,7 @@
|
||||
{
|
||||
services.AddDbContext<WebhooksContext>(options =>
|
||||
{
|
||||
options.UseSqlServer(configuration.GetRequiredConnectionString("WebHooksDb"),
|
||||
options.UseSqlServer(configuration.GetRequiredConnectionString("WebHooksDB"),
|
||||
sqlServerOptionsAction: sqlOptions =>
|
||||
{
|
||||
sqlOptions.MigrationsAssembly(typeof(Program).Assembly.FullName);
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
hcBuilder
|
||||
.AddSqlServer(_ =>
|
||||
configuration.GetRequiredConnectionString("WebHooksDb"),
|
||||
configuration.GetRequiredConnectionString("WebHooksDB"),
|
||||
name: "WebhooksApiDb-check",
|
||||
tags: new string[] { "ready" });
|
||||
|
||||
|
@ -7,6 +7,6 @@
|
||||
}
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"WebHooksDb": "Server=tcp:127.0.0.1,5433;Initial Catalog=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word;TrustServerCertificate=true"
|
||||
"WebHooksDB": "Server=tcp:127.0.0.1,5433;Initial Catalog=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word;TrustServerCertificate=true"
|
||||
}
|
||||
}
|
||||
|
@ -53,12 +53,6 @@
|
||||
<ProjectReference Include="..\..\..\Web\WebMVC\WebMVC.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="Services\Locations\appsettings.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
|
||||
</ItemGroup>
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user