Skip to content
This repository was archived by the owner on Nov 17, 2023. It is now read-only.

Commit 3858d7c

Browse files
committed
Fix integration tests
1 parent a87efde commit 3858d7c

File tree

15 files changed

+7918
-7923
lines changed

15 files changed

+7918
-7923
lines changed

src/Services/Basket/Basket.FunctionalTests/Base/BasketScenarioBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ protected override IHost CreateHost(IHostBuilder builder)
4545
{
4646
var directory = Path.GetDirectoryName(typeof(BasketScenarioBase).Assembly.Location)!;
4747

48-
c.AddJsonFile(Path.Combine(directory, "appsettings.json"), optional: false);
48+
c.AddJsonFile(Path.Combine(directory, "appsettings.Basket.json"), optional: false);
4949
});
5050

5151
return base.CreateHost(builder);

src/Services/Basket/Basket.FunctionalTests/Basket.FunctionalTests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<Content Include="appsettings.json">
10+
<Content Include="appsettings.Basket.json">
1111
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
1212
</Content>
1313
</ItemGroup>

src/Services/Catalog/Catalog.FunctionalTests/Catalog.FunctionalTests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<None Remove="appsettings.json" />
10+
<None Remove="appsettings.Catalog.json" />
1111
<None Remove="Setup\CatalogBrands.csv" />
1212
<None Remove="Setup\CatalogItems.csv" />
1313
<None Remove="Setup\CatalogItems.zip" />
1414
<None Remove="Setup\CatalogTypes.csv" />
1515
</ItemGroup>
1616

1717
<ItemGroup>
18-
<Content Include="appsettings.json">
18+
<Content Include="appsettings.Catalog.json">
1919
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
2020
</Content>
2121
<Content Include="Setup\CatalogBrands.csv">

src/Services/Catalog/Catalog.FunctionalTests/CatalogScenarioBase.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
1-
using Microsoft.AspNetCore.Mvc.Testing;
1+
using System;
2+
using Microsoft.AspNetCore.Mvc.Testing;
23

34
namespace Catalog.FunctionalTests;
45

56
public class CatalogScenariosBase
67
{
7-
public TestServer CreateServer()
8-
{
9-
var factory = new CatalogApplication();
10-
return factory.Server;
11-
}
12-
138
private class CatalogApplication : WebApplicationFactory<Program>
149
{
1510
protected override IHost CreateHost(IHostBuilder builder)
@@ -18,13 +13,19 @@ protected override IHost CreateHost(IHostBuilder builder)
1813
{
1914
var directory = Path.GetDirectoryName(typeof(CatalogScenariosBase).Assembly.Location)!;
2015

21-
c.AddJsonFile(Path.Combine(directory, "appsettings.json"), optional: false);
16+
c.AddJsonFile(Path.Combine(directory, "appsettings.Catalog.json"), optional: false);
2217
});
2318

2419
return base.CreateHost(builder);
2520
}
2621
}
2722

23+
public TestServer CreateServer()
24+
{
25+
var factory = new CatalogApplication();
26+
return factory.Server;
27+
}
28+
2829
public static class Get
2930
{
3031
private const int PageIndex = 0;

src/Services/Catalog/Catalog.FunctionalTests/appsettings.json renamed to src/Services/Catalog/Catalog.FunctionalTests/appsettings.Catalog.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"PicBaseUrl": "http://localhost:5101/api/v1/catalog/items/[0]/pic/",
55

66
"ConnectionStrings": {
7-
"CatalogDb": "Server=tcp:127.0.0.1,5433;Initial Catalog=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word;Encrypt=False;TrustServerCertificate=true"
7+
"CatalogDB": "Server=tcp:127.0.0.1,5433;Initial Catalog=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word;Encrypt=False;TrustServerCertificate=true"
88
},
99

1010
"EventBus": {

src/Services/Identity/Identity.API/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
builder.Services.AddControllersWithViews();
66

77
builder.Services.AddDbContext<ApplicationDbContext>(options =>
8-
options.UseSqlServer(builder.Configuration.GetConnectionString("IdentityDb")));
8+
options.UseSqlServer(builder.Configuration.GetConnectionString("IdentityDB")));
99

1010
builder.Services.AddIdentity<ApplicationUser, IdentityRole>()
1111
.AddEntityFrameworkStores<ApplicationDbContext>()
@@ -30,7 +30,7 @@
3030

3131
builder.Services.AddHealthChecks()
3232
.AddSqlServer(_ =>
33-
builder.Configuration.GetRequiredConnectionString("IdentityDb"),
33+
builder.Configuration.GetRequiredConnectionString("IdentityDB"),
3434
name: "IdentityDB-check",
3535
tags: new string[] { "IdentityDB" });
3636

src/Services/Ordering/Ordering.BackgroundTasks/Extensions/CustomExtensionMethods.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ public static IServiceCollection AddHealthChecks(this IServiceCollection service
77
var hcBuilder = services.AddHealthChecks();
88

99
hcBuilder.AddSqlServer(_ =>
10-
configuration.GetRequiredConnectionString("OrderingDb"),
10+
configuration.GetRequiredConnectionString("OrderingDB"),
1111
name: "OrderingTaskDB-check",
1212
tags: new string[] { "live", "ready" });
1313

@@ -19,7 +19,7 @@ public static IServiceCollection AddApplicationOptions(this IServiceCollection s
1919
return services.Configure<BackgroundTaskSettings>(configuration)
2020
.Configure<BackgroundTaskSettings>(o =>
2121
{
22-
o.ConnectionString = configuration.GetRequiredConnectionString("OrderingDb");
22+
o.ConnectionString = configuration.GetRequiredConnectionString("OrderingDB");
2323
});
2424
}
2525
}

src/Services/Ordering/Ordering.FunctionalTests/Ordering.FunctionalTests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<Content Include="appsettings.json">
10+
<Content Include="appsettings.Ordering.json">
1111
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
1212
</Content>
1313
</ItemGroup>

src/Services/Ordering/Ordering.FunctionalTests/OrderingScenarioBase.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ public TestServer CreateServer()
1414

1515
protected override IHost CreateHost(IHostBuilder builder)
1616
{
17-
builder.ConfigureServices(servies =>
17+
builder.ConfigureServices(services =>
1818
{
19-
servies.AddSingleton<IStartupFilter, AuthStartupFilter>();
19+
services.AddSingleton<IStartupFilter, AuthStartupFilter>();
2020
});
2121

2222
builder.ConfigureAppConfiguration(c =>
2323
{
2424
var directory = Path.GetDirectoryName(typeof(OrderingScenarioBase).Assembly.Location)!;
2525

26-
c.AddJsonFile(Path.Combine(directory, "appsettings.json"), optional: false);
26+
c.AddJsonFile(Path.Combine(directory, "appsettings.Ordering.json"), optional: false);
2727
});
2828

2929
return base.CreateHost(builder);

0 commit comments

Comments
 (0)