mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 10:42:08 +00:00
Add TestApiFactory for BDD testing setup and include API.Specs project in solution
This commit is contained in:
20
src/Core/API/API.Specs/TestApiFactory.cs
Normal file
20
src/Core/API/API.Specs/TestApiFactory.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Mvc.Testing;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
namespace API.Specs
|
||||
{
|
||||
public class TestApiFactory : WebApplicationFactory<Program>
|
||||
{
|
||||
protected override void ConfigureWebHost(IWebHostBuilder builder)
|
||||
{
|
||||
builder.UseEnvironment("Testing");
|
||||
|
||||
builder.ConfigureAppConfiguration((context, configBuilder) =>
|
||||
{
|
||||
var connectionString = Environment.GetEnvironmentVariable("DB_CONNECTION_STRING");
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
<Solution>
|
||||
<Folder Name="/API/" >
|
||||
<Project Path="API/API.Core/API.Core.csproj"/>
|
||||
<Project Path="API/API.Specs/API.Specs.csproj"/>
|
||||
</Folder>
|
||||
<Folder Name="/Database/">
|
||||
<Project Path="Database/Database.Core/Database.Core.csproj" />
|
||||
|
||||
Reference in New Issue
Block a user