Added check to see if mount folder is empty (#871)
* Added check for if mount folder is empty * updating log message * Adding unit test
This commit is contained in:
parent
b4a80f9b65
commit
358b674aa9
3 changed files with 46 additions and 4 deletions
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Abstractions;
|
||||
|
@ -373,6 +373,29 @@ namespace API.Tests.Services
|
|||
}
|
||||
#endregion
|
||||
|
||||
#region IsDirectoryEmpty
|
||||
[Fact]
|
||||
public void IsDirectoryEmpty_DirectoryIsEmpty()
|
||||
{
|
||||
const string testDirectory = "c:/manga/";
|
||||
var fileSystem = new MockFileSystem();
|
||||
var ds = new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), fileSystem);
|
||||
|
||||
Assert.False(ds.IsDirectoryEmpty("c:/manga/"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void IsDirectoryEmpty_DirectoryIsNotEmpty()
|
||||
{
|
||||
const string testDirectory = "c:/manga/";
|
||||
var fileSystem = new MockFileSystem();
|
||||
fileSystem.AddFile($"{testDirectory}data-0.txt", new MockFileData("abc"));
|
||||
var ds = new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), fileSystem);
|
||||
|
||||
Assert.False(ds.IsDirectoryEmpty("c:/manga/"));
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ExistOrCreate
|
||||
[Fact]
|
||||
public void ExistOrCreate_ShouldCreate()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue