Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,10 @@
<ProjectReference Include="..\..\Api\Api.csproj" />
</ItemGroup>

<ItemGroup>
<Content Include="appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@

namespace IdentityService.IntegrationTests;

public class OutboxTests : IClassFixture<WebApplicationFactory<Program>>
public class OutboxTests : IClassFixture<ApiFactory>
{
private readonly WebApplicationFactory<Program> _factory;
private readonly ApiFactory _factory;

public OutboxTests(WebApplicationFactory<Program> factory)
public OutboxTests(ApiFactory factory)
{
_factory = factory;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,16 @@ public class ApiFactory : WebApplicationFactory<Program>, IAsyncLifetime
.WithPassword("testpass")
.Build();

// این متد برای پیکربندی WebHost قبل از ساخت برنامه استفاده می‌شود.
// این متد برای پیکربNazi WebHost قبل از ساخت برنامه استفاده می‌شود.
protected override void ConfigureWebHost(IWebHostBuilder builder)
{
// رشته اتصال پیش‌فرض را با رشته اتصال کانتینر PostgreSQL جایگزین می‌کنیم.
builder.ConfigureAppConfiguration(config =>
builder.ConfigureAppConfiguration((context, config) =>
{
// Load test settings
config.AddJsonFile("appsettings.json");

// Override connection string with the one from Testcontainers
config.AddInMemoryCollection(new Dictionary<string, string?>
{
["ConnectionStrings:DefaultConnection"] = _dbContainer.GetConnectionString()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"Jwt": {
"SecretKey": "YourSuperSecretKeyThatShouldBeAtLeast32CharactersLongForTests!",
"Issuer": "IdentityService.Test",
"Audience": "IdentityService.Test"
},
"ConnectionStrings": {
"DefaultConnection": "Server=localhost;Port=5432;Database=MasirYarTestDb;User Id=test;Password=test;"
}
}
Loading
Loading