Use proper xunit single threading

This commit is contained in:
Adam Hathcock
2018-05-05 09:38:56 +01:00
parent 88b59600cd
commit 18475cc86d

View File

@@ -6,9 +6,11 @@ using System.Threading;
using SharpCompress.Readers;
using Xunit;
[assembly: CollectionBehavior(DisableTestParallelization = true)]
namespace SharpCompress.Test
{
public class TestBase : IDisposable
public class TestBase
{
protected string SOLUTION_BASE_PATH = null;
protected string TEST_ARCHIVES_PATH;
@@ -270,12 +272,8 @@ namespace SharpCompress.Test
return false;
}
private static readonly object lockObject = new object();
public TestBase()
{
Monitor.Enter(lockObject);
var index = AppDomain.CurrentDomain.BaseDirectory.IndexOf("SharpCompress.Test", StringComparison.OrdinalIgnoreCase);
SOLUTION_BASE_PATH = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory.Substring(0, index));
@@ -285,10 +283,5 @@ namespace SharpCompress.Test
SCRATCH_FILES_PATH = Path.Combine(SOLUTION_BASE_PATH, "TestArchives", "Scratch");
SCRATCH2_FILES_PATH = Path.Combine(SOLUTION_BASE_PATH, "TestArchives", "Scratch2");
}
public void Dispose()
{
Monitor.Exit(lockObject);
}
}
}