From 24ef0a74a526033406a27f8e0446eef6cca9453b Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Sat, 11 Apr 2020 14:00:52 -0500 Subject: [PATCH] VirtualFileSystemTests utilize xUnit IAsyncLifetime --- .../VirtualFileSystemTests.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Wabbajack.VirtualFileSystem.Test/VirtualFileSystemTests.cs b/Wabbajack.VirtualFileSystem.Test/VirtualFileSystemTests.cs index 12e27073..5059fbf8 100644 --- a/Wabbajack.VirtualFileSystem.Test/VirtualFileSystemTests.cs +++ b/Wabbajack.VirtualFileSystem.Test/VirtualFileSystemTests.cs @@ -9,7 +9,7 @@ using Xunit.Abstractions; namespace Wabbajack.VirtualFileSystem.Test { - public class VFSTests + public class VFSTests : IAsyncLifetime { private static readonly AbsolutePath VFS_TEST_DIR = "vfs_test_dir".ToPath().RelativeToEntryPoint(); private static readonly AbsolutePath TEST_ZIP = "test.zip".RelativeTo(VFS_TEST_DIR); @@ -18,21 +18,24 @@ namespace Wabbajack.VirtualFileSystem.Test private Context context; private readonly ITestOutputHelper _helper; - private WorkQueue Queue { get; } + private WorkQueue Queue { get; } = new WorkQueue(); public VFSTests(ITestOutputHelper helper) { _helper = helper; Utils.LogMessages.Subscribe(f => _helper.WriteLine(f.ShortDescription)); - Queue = new WorkQueue(); context = new Context(Queue); } - public static async Task Factory(ITestOutputHelper helper) + public async Task InitializeAsync() { await VFS_TEST_DIR.DeleteDirectory(); VFS_TEST_DIR.CreateDirectory(); - return new VFSTests(helper); + } + + public async Task DisposeAsync() + { + await VFS_TEST_DIR.DeleteDirectory(); } [Fact] @@ -56,7 +59,6 @@ namespace Wabbajack.VirtualFileSystem.Test await context.IntegrateFromFile( "vfs_cache.bin".RelativeTo(VFS_TEST_DIR)); } - [Fact] public async Task ArchiveContentsAreIndexed() {