forked from ddrilling/AsbCloudServer
20 lines
649 B
C#
20 lines
649 B
C#
using AsbCloudDb.Model;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace AsbCloudWebApi.Tests
|
|
{
|
|
internal static class TestHelpter
|
|
{
|
|
public static AsbCloudDbContext MakeTestContext()
|
|
{
|
|
var options = new DbContextOptionsBuilder<AsbCloudDbContext>()
|
|
.UseNpgsql("Host=localhost;Database=tests;Username=postgres;Password=q;Persist Security Info=True;Include Error Detail=True")
|
|
.Options;
|
|
var context = new AsbCloudDbContext(options);
|
|
context.Database.EnsureDeleted();
|
|
context.Database.EnsureCreated();
|
|
return context;
|
|
}
|
|
}
|
|
}
|