DD.WellWorkover.Cloud/AsbCloudWebApi.Tests/TestHelpter.cs

25 lines
765 B
C#
Raw Normal View History

2022-01-09 11:46:27 +05:00
using AsbCloudDb.Model;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
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);
2022-02-21 12:04:26 +05:00
context.Database.EnsureDeleted();
context.Database.EnsureCreated();
2022-01-09 11:46:27 +05:00
return context;
}
}
}