[skip ci] Fix unit tests on macOS (And probably Unix) (#3647)
This commit is contained in:
parent
e897fb9a12
commit
98a2b9d3ed
12 changed files with 154 additions and 172 deletions
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.IO;
|
||||
using System.IO.Abstractions.TestingHelpers;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
|
@ -21,24 +22,13 @@ using NSubstitute;
|
|||
|
||||
namespace API.Tests;
|
||||
|
||||
public abstract class AbstractDbTest : IDisposable
|
||||
public abstract class AbstractDbTest : AbstractFsTest , IDisposable
|
||||
{
|
||||
protected readonly DbConnection _connection;
|
||||
protected readonly DataContext _context;
|
||||
protected readonly IUnitOfWork _unitOfWork;
|
||||
protected readonly IMapper _mapper;
|
||||
|
||||
|
||||
protected const string CacheDirectory = "C:/kavita/config/cache/";
|
||||
protected const string CacheLongDirectory = "C:/kavita/config/cache-long/";
|
||||
protected const string CoverImageDirectory = "C:/kavita/config/covers/";
|
||||
protected const string BackupDirectory = "C:/kavita/config/backups/";
|
||||
protected const string LogDirectory = "C:/kavita/config/logs/";
|
||||
protected const string BookmarkDirectory = "C:/kavita/config/bookmarks/";
|
||||
protected const string SiteThemeDirectory = "C:/kavita/config/themes/";
|
||||
protected const string TempDirectory = "C:/kavita/config/temp/";
|
||||
protected const string DataDirectory = "C:/data/";
|
||||
|
||||
protected AbstractDbTest()
|
||||
{
|
||||
var contextOptions = new DbContextOptionsBuilder<DataContext>()
|
||||
|
|
@ -113,24 +103,6 @@ public abstract class AbstractDbTest : IDisposable
|
|||
|
||||
protected abstract Task ResetDb();
|
||||
|
||||
protected static MockFileSystem CreateFileSystem()
|
||||
{
|
||||
var fileSystem = new MockFileSystem();
|
||||
fileSystem.Directory.SetCurrentDirectory("C:/kavita/");
|
||||
fileSystem.AddDirectory("C:/kavita/config/");
|
||||
fileSystem.AddDirectory(CacheDirectory);
|
||||
fileSystem.AddDirectory(CacheLongDirectory);
|
||||
fileSystem.AddDirectory(CoverImageDirectory);
|
||||
fileSystem.AddDirectory(BackupDirectory);
|
||||
fileSystem.AddDirectory(BookmarkDirectory);
|
||||
fileSystem.AddDirectory(SiteThemeDirectory);
|
||||
fileSystem.AddDirectory(LogDirectory);
|
||||
fileSystem.AddDirectory(TempDirectory);
|
||||
fileSystem.AddDirectory(DataDirectory);
|
||||
|
||||
return fileSystem;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_context.Dispose();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue