diff options
author | 杨宇千 <crupest@outlook.com> | 2019-08-17 20:33:01 +0800 |
---|---|---|
committer | 杨宇千 <crupest@outlook.com> | 2019-08-17 20:33:01 +0800 |
commit | 8225c5ff0092f2d666a8c012dffbbc0b428c7d9b (patch) | |
tree | 3127ceaf927c8ae3fb38a5bc25904d2d36973bee /Timeline.Tests/AuthorizationUnitTest.cs | |
parent | 6edc70c00bca22e13ade23472d48d7b940f92eef (diff) | |
download | timeline-8225c5ff0092f2d666a8c012dffbbc0b428c7d9b.tar.gz timeline-8225c5ff0092f2d666a8c012dffbbc0b428c7d9b.tar.bz2 timeline-8225c5ff0092f2d666a8c012dffbbc0b428c7d9b.zip |
Finally solve the database conflict problem in unit tests.
Diffstat (limited to 'Timeline.Tests/AuthorizationUnitTest.cs')
-rw-r--r-- | Timeline.Tests/AuthorizationUnitTest.cs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Timeline.Tests/AuthorizationUnitTest.cs b/Timeline.Tests/AuthorizationUnitTest.cs index 6f52a12d..4751e95f 100644 --- a/Timeline.Tests/AuthorizationUnitTest.cs +++ b/Timeline.Tests/AuthorizationUnitTest.cs @@ -1,5 +1,6 @@ using FluentAssertions;
using Microsoft.AspNetCore.Mvc.Testing;
+using System;
using System.Net;
using System.Threading.Tasks;
using Timeline.Tests.Helpers;
@@ -9,17 +10,23 @@ using Xunit.Abstractions; namespace Timeline.Tests
{
- public class AuthorizationUnitTest : IClassFixture<MyWebApplicationFactory<Startup>>
+ public class AuthorizationUnitTest : IClassFixture<MyWebApplicationFactory<Startup>>, IDisposable
{
private const string AuthorizeUrl = "Test/User/Authorize";
private const string UserUrl = "Test/User/User";
private const string AdminUrl = "Test/User/Admin";
private readonly WebApplicationFactory<Startup> _factory;
+ private readonly Action _disposeAction;
public AuthorizationUnitTest(MyWebApplicationFactory<Startup> factory, ITestOutputHelper outputHelper)
{
- _factory = factory.WithTestLogging(outputHelper);
+ _factory = factory.WithTestConfig(outputHelper, out _disposeAction);
+ }
+
+ public void Dispose()
+ {
+ _disposeAction();
}
[Fact]
|