aboutsummaryrefslogtreecommitdiff
path: root/Timeline.Tests/Helpers/TestApplication.cs
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-01-30 23:49:02 +0800
committercrupest <crupest@outlook.com>2020-01-30 23:49:02 +0800
commit5aaa4f95e6bdd46e6740c1ecbbd46bdf415eedd2 (patch)
tree70ddc26cf29bdf4b19e9a746cac6017845e009fc /Timeline.Tests/Helpers/TestApplication.cs
parentd988669de355df12d3be3c658e8617c275fe70dd (diff)
downloadtimeline-5aaa4f95e6bdd46e6740c1ecbbd46bdf415eedd2.tar.gz
timeline-5aaa4f95e6bdd46e6740c1ecbbd46bdf415eedd2.tar.bz2
timeline-5aaa4f95e6bdd46e6740c1ecbbd46bdf415eedd2.zip
Finish reafctor, TODO: Database migration.
Diffstat (limited to 'Timeline.Tests/Helpers/TestApplication.cs')
-rw-r--r--Timeline.Tests/Helpers/TestApplication.cs12
1 files changed, 11 insertions, 1 deletions
diff --git a/Timeline.Tests/Helpers/TestApplication.cs b/Timeline.Tests/Helpers/TestApplication.cs
index 14cafea3..bc5deeec 100644
--- a/Timeline.Tests/Helpers/TestApplication.cs
+++ b/Timeline.Tests/Helpers/TestApplication.cs
@@ -17,10 +17,20 @@ namespace Timeline.Tests.Helpers
public TestApplication(WebApplicationFactory<Startup> factory)
{
DatabaseConnection = new SqliteConnection("Data Source=:memory:;");
+ DatabaseConnection.Open();
+
+ var options = new DbContextOptionsBuilder<DevelopmentDatabaseContext>()
+ .UseSqlite(DatabaseConnection)
+ .Options;
+
+ using (var context = new DevelopmentDatabaseContext(options))
+ {
+ context.Database.EnsureCreated();
+ }
Factory = factory.WithWebHostBuilder(builder =>
{
- builder.ConfigureTestServices(services =>
+ builder.ConfigureServices(services =>
{
services.AddDbContext<DatabaseContext, DevelopmentDatabaseContext>(options =>
{