Implemented download log files (not in service). Refactored backupservice to handle log file splitting. Improved a few interfaces and added some unit tests around them.
This commit is contained in:
parent
30352403cf
commit
bbb4240e20
22 changed files with 292 additions and 46 deletions
46
API.Tests/Services/BackupServiceTests.cs
Normal file
46
API.Tests/Services/BackupServiceTests.cs
Normal file
|
@ -0,0 +1,46 @@
|
|||
using API.Interfaces;
|
||||
using API.Services;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using NSubstitute;
|
||||
|
||||
namespace API.Tests.Services
|
||||
{
|
||||
public class BackupServiceTests
|
||||
{
|
||||
private readonly DirectoryService _directoryService;
|
||||
private readonly BackupService _backupService;
|
||||
private readonly IUnitOfWork _unitOfWork = Substitute.For<IUnitOfWork>();
|
||||
private readonly ILogger<DirectoryService> _directoryLogger = Substitute.For<ILogger<DirectoryService>>();
|
||||
private readonly ILogger<BackupService> _logger = Substitute.For<ILogger<BackupService>>();
|
||||
private readonly IConfiguration _config;
|
||||
|
||||
// public BackupServiceTests()
|
||||
// {
|
||||
// var inMemorySettings = new Dictionary<string, string> {
|
||||
// {"Logging:File:MaxRollingFiles", "0"},
|
||||
// {"Logging:File:Path", "file.log"},
|
||||
// };
|
||||
//
|
||||
// _config = new ConfigurationBuilder()
|
||||
// .AddInMemoryCollection(inMemorySettings)
|
||||
// .Build();
|
||||
//
|
||||
// //_config.GetMaxRollingFiles().Returns(0);
|
||||
// //_config.GetLoggingFileName().Returns("file.log");
|
||||
// //var testDirectory = Path.Join(Directory.GetCurrentDirectory(), "../../../Services/Test Data/BackupService/");
|
||||
// //Directory.GetCurrentDirectory().Returns(testDirectory);
|
||||
//
|
||||
// _directoryService = new DirectoryService(_directoryLogger);
|
||||
// _backupService = new BackupService(_unitOfWork, _logger, _directoryService, _config);
|
||||
// }
|
||||
//
|
||||
// [Fact]
|
||||
// public void Test()
|
||||
// {
|
||||
// _backupService.BackupDatabase();
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue