Feature/tech debt (#199)
* Added an icon for building the exe * Technical debt
This commit is contained in:
parent
d92e9e7602
commit
f694145cd9
26 changed files with 76 additions and 112 deletions
|
|
@ -1,6 +1,4 @@
|
|||
using System;
|
||||
using API.Data;
|
||||
using API.Tests.Helpers;
|
||||
using API.Data;
|
||||
using Xunit;
|
||||
|
||||
namespace API.Tests.Entities
|
||||
|
|
|
|||
|
|
@ -1,10 +1,4 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using API.Extensions;
|
||||
using NSubstitute;
|
||||
using Xunit;
|
||||
|
||||
namespace API.Tests.Extensions
|
||||
namespace API.Tests.Extensions
|
||||
{
|
||||
public class FileInfoExtensionsTests
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using API.Entities;
|
||||
using API.Entities.Enums;
|
||||
using API.Extensions;
|
||||
using API.Parser;
|
||||
|
|
@ -12,7 +11,7 @@ namespace API.Tests.Extensions
|
|||
public class ParserInfoListExtensions
|
||||
{
|
||||
[Theory]
|
||||
[InlineData(new string[] {"1", "1", "3-5", "5", "8", "0", "0"}, new string[] {"1", "3-5", "5", "8", "0"})]
|
||||
[InlineData(new[] {"1", "1", "3-5", "5", "8", "0", "0"}, new[] {"1", "3-5", "5", "8", "0"})]
|
||||
public void DistinctVolumesTest(string[] volumeNumbers, string[] expectedNumbers)
|
||||
{
|
||||
var infos = volumeNumbers.Select(n => new ParserInfo() {Volumes = n}).ToList();
|
||||
|
|
@ -20,9 +19,9 @@ namespace API.Tests.Extensions
|
|||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(new string[] {@"Cynthia The Mission - c000-006 (v06) [Desudesu&Brolen].zip"}, new string[] {@"E:\Manga\Cynthia the Mission\Cynthia The Mission - c000-006 (v06) [Desudesu&Brolen].zip"}, true)]
|
||||
[InlineData(new string[] {@"Cynthia The Mission - c000-006 (v06-07) [Desudesu&Brolen].zip"}, new string[] {@"E:\Manga\Cynthia the Mission\Cynthia The Mission - c000-006 (v06) [Desudesu&Brolen].zip"}, true)]
|
||||
[InlineData(new string[] {@"Cynthia The Mission v20 c12-20 [Desudesu&Brolen].zip"}, new string[] {@"E:\Manga\Cynthia the Mission\Cynthia The Mission - c000-006 (v06) [Desudesu&Brolen].zip"}, false)]
|
||||
[InlineData(new[] {@"Cynthia The Mission - c000-006 (v06) [Desudesu&Brolen].zip"}, new[] {@"E:\Manga\Cynthia the Mission\Cynthia The Mission - c000-006 (v06) [Desudesu&Brolen].zip"}, true)]
|
||||
[InlineData(new[] {@"Cynthia The Mission - c000-006 (v06-07) [Desudesu&Brolen].zip"}, new[] {@"E:\Manga\Cynthia the Mission\Cynthia The Mission - c000-006 (v06) [Desudesu&Brolen].zip"}, true)]
|
||||
[InlineData(new[] {@"Cynthia The Mission v20 c12-20 [Desudesu&Brolen].zip"}, new[] {@"E:\Manga\Cynthia the Mission\Cynthia The Mission - c000-006 (v06) [Desudesu&Brolen].zip"}, false)]
|
||||
public void HasInfoTest(string[] inputInfos, string[] inputChapters, bool expectedHasInfo)
|
||||
{
|
||||
var infos = new List<ParserInfo>();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using API.Entities;
|
||||
using API.Entities;
|
||||
using API.Extensions;
|
||||
using Xunit;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using API.Services;
|
||||
using System.IO;
|
||||
|
||||
namespace API.Tests.Helpers
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using API.Services;
|
||||
using Xunit;
|
||||
using Xunit;
|
||||
|
||||
namespace API.Tests.Parser
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System.IO;
|
||||
using API.Entities.Interfaces;
|
||||
using API.Interfaces;
|
||||
using API.Services;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
using API.Services;
|
||||
using API.Tests.Helpers;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using NSubstitute;
|
||||
using Xunit;
|
||||
|
|
@ -20,16 +19,15 @@ namespace API.Tests.Services
|
|||
_directoryService = new DirectoryService(_logger);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("Manga-testcase.txt", 28)]
|
||||
public void GetFilesTest(string file, int expectedFileCount)
|
||||
[Fact]
|
||||
public void GetFilesTest_Should_Be28()
|
||||
{
|
||||
var testDirectory = Path.Join(Directory.GetCurrentDirectory(), "../../../Services/Test Data/ScannerService/Manga");
|
||||
var files = new List<string>();
|
||||
var fileCount = DirectoryService.TraverseTreeParallelForEach(testDirectory, s => files.Add(s),
|
||||
API.Parser.Parser.ArchiveFileExtensions, _logger);
|
||||
|
||||
Assert.Equal(expectedFileCount, fileCount);
|
||||
Assert.Equal(28, fileCount);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
|
|||
|
|
@ -29,10 +29,8 @@ namespace API.Tests.Services
|
|||
private readonly ITestOutputHelper _testOutputHelper;
|
||||
private readonly ScannerService _scannerService;
|
||||
private readonly ILogger<ScannerService> _logger = Substitute.For<ILogger<ScannerService>>();
|
||||
private readonly IUnitOfWork _unitOfWork;
|
||||
private readonly IArchiveService _archiveService = Substitute.For<IArchiveService>();
|
||||
private readonly IBookService _bookService = Substitute.For<IBookService>();
|
||||
private readonly IMetadataService _metadataService;
|
||||
private readonly ILogger<MetadataService> _metadataLogger = Substitute.For<ILogger<MetadataService>>();
|
||||
|
||||
private readonly DbConnection _connection;
|
||||
|
|
@ -58,13 +56,12 @@ namespace API.Tests.Services
|
|||
|
||||
|
||||
// Substitute.For<UserManager<AppUser>>() - Not needed because only for UserService
|
||||
_unitOfWork = new UnitOfWork(_context, Substitute.For<IMapper>(), null,
|
||||
Substitute.For<ILogger<UnitOfWork>>());
|
||||
IUnitOfWork unitOfWork = new UnitOfWork(_context, Substitute.For<IMapper>(), null);
|
||||
|
||||
|
||||
_testOutputHelper = testOutputHelper;
|
||||
_metadataService= Substitute.For<MetadataService>(_unitOfWork, _metadataLogger, _archiveService, _bookService);
|
||||
_scannerService = new ScannerService(_unitOfWork, _logger, _archiveService, _metadataService, _bookService);
|
||||
IMetadataService metadataService = Substitute.For<MetadataService>(unitOfWork, _metadataLogger, _archiveService, _bookService);
|
||||
_scannerService = new ScannerService(unitOfWork, _logger, _archiveService, metadataService, _bookService);
|
||||
}
|
||||
|
||||
private async Task<bool> SeedDb()
|
||||
|
|
@ -118,10 +115,9 @@ namespace API.Tests.Services
|
|||
OriginalName = "Darker Than Black",
|
||||
NormalizedName = API.Parser.Parser.Normalize("Darker Than Black")
|
||||
});
|
||||
var expectedSeries = new List<Series>();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Assert.Empty(_scannerService.FindSeriesNotOnDisk(existingSeries, infos));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue