Refactored more archive code into the service and updated documentation now that methods are public.

This commit is contained in:
Joseph Milazzo 2021-01-26 10:03:06 -06:00
parent 6b76c8b211
commit 6621730afb
13 changed files with 137 additions and 125 deletions

View file

@ -9,23 +9,15 @@ namespace API.Tests.Services
{
public class ScannerServiceTests
{
private readonly ScannerService _scannerService;
private readonly ILogger<ScannerService> _logger = Substitute.For<ILogger<ScannerService>>();
private readonly IUnitOfWork _unitOfWork = Substitute.For<IUnitOfWork>();
private readonly string _testDirectory = Path.Join(Directory.GetCurrentDirectory(), "../../../Services/Test Data/ScannerService");
public ScannerServiceTests()
{
_scannerService = new ScannerService(_unitOfWork, _logger);
}
// private readonly ScannerService _scannerService;
// private readonly ILogger<ScannerService> _logger = Substitute.For<ILogger<ScannerService>>();
// private readonly IUnitOfWork _unitOfWork = Substitute.For<IUnitOfWork>();
// private readonly string _testDirectory = Path.Join(Directory.GetCurrentDirectory(), "../../../Services/Test Data/ScannerService");
// public ScannerServiceTests()
// {
// _scannerService = new ScannerService(_unitOfWork, _logger);
// }
[Theory]
[InlineData("v10.cbz", "v10.expected.jpg")]
[InlineData("v10 - with folder.cbz", "v10 - with folder.expected.jpg")]
[InlineData("v10 - nested folder.cbz", "v10 - nested folder.expected.jpg")]
public void GetCoverImageTest(string inputFile, string expectedOutputFile)
{
var expectedBytes = File.ReadAllBytes(Path.Join(_testDirectory, expectedOutputFile));
Assert.Equal(expectedBytes, _scannerService.GetCoverImage(Path.Join(_testDirectory, inputFile)));
}
}
}