diff options
author | crupest <crupest@outlook.com> | 2020-12-17 20:08:33 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2020-12-17 20:08:33 +0800 |
commit | 0bda82609a08965f7bfefd20af3ab5112ce98dd2 (patch) | |
tree | f46bf4624a600e04a5c14917b97073a5c69fe30b /BackEnd/Timeline.Tests/Services/DatabaseBasedTest.cs | |
parent | 81ab4cf5c0a2d35042cb4f15a1ff699e7ba9068b (diff) | |
download | timeline-0bda82609a08965f7bfefd20af3ab5112ce98dd2.tar.gz timeline-0bda82609a08965f7bfefd20af3ab5112ce98dd2.tar.bz2 timeline-0bda82609a08965f7bfefd20af3ab5112ce98dd2.zip |
...
Diffstat (limited to 'BackEnd/Timeline.Tests/Services/DatabaseBasedTest.cs')
-rw-r--r-- | BackEnd/Timeline.Tests/Services/DatabaseBasedTest.cs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/BackEnd/Timeline.Tests/Services/DatabaseBasedTest.cs b/BackEnd/Timeline.Tests/Services/DatabaseBasedTest.cs index 3bb6ebb5..90fb6463 100644 --- a/BackEnd/Timeline.Tests/Services/DatabaseBasedTest.cs +++ b/BackEnd/Timeline.Tests/Services/DatabaseBasedTest.cs @@ -2,6 +2,7 @@ using Timeline.Entities;
using Timeline.Tests.Helpers;
using Xunit;
+using Xunit.Abstractions;
namespace Timeline.Tests.Services
{
@@ -10,15 +11,20 @@ namespace Timeline.Tests.Services protected TestDatabase TestDatabase { get; }
protected DatabaseContext Database { get; private set; } = default!;
- protected DatabaseBasedTest(bool databaseCreateUsers = true)
+ private readonly ITestOutputHelper? _testOutputHelper;
+
+ protected DatabaseBasedTest(bool databaseCreateUsers = true, ITestOutputHelper? testOutputHelper = null)
{
+ _testOutputHelper = testOutputHelper;
TestDatabase = new TestDatabase(databaseCreateUsers);
}
+ protected DatabaseBasedTest(ITestOutputHelper? testOutputHelper) : this(true, testOutputHelper) { }
+
public async Task InitializeAsync()
{
await TestDatabase.InitializeAsync();
- Database = TestDatabase.CreateContext();
+ Database = TestDatabase.CreateContext(_testOutputHelper);
await OnDatabaseCreatedAsync();
OnDatabaseCreated();
}
|