mirror of https://github.com/Radarr/Radarr
54 lines
1.5 KiB
C#
54 lines
1.5 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using FizzWare.NBuilder;
|
|
using Moq;
|
|
using NUnit.Framework;
|
|
using NzbDrone.Common.Disk;
|
|
using NzbDrone.Core.HealthCheck.Checks;
|
|
using NzbDrone.Core.Test.Framework;
|
|
using NzbDrone.Core.Movies;
|
|
|
|
namespace NzbDrone.Core.Test.HealthCheck.Checks
|
|
{
|
|
[TestFixture]
|
|
public class RootFolderCheckFixture : CoreTest<RootFolderCheck>
|
|
{
|
|
private void GivenMissingRootFolder()
|
|
{
|
|
var movies = Builder<Movie>.CreateListOfSize(1)
|
|
.Build()
|
|
.ToList();
|
|
|
|
Mocker.GetMock<IMovieService>()
|
|
.Setup(s => s.AllMoviePaths())
|
|
.Returns(movies.Select(x => x.Path).ToList());
|
|
|
|
Mocker.GetMock<IDiskProvider>()
|
|
.Setup(s => s.GetParentFolder(movies.First().Path))
|
|
.Returns(@"C:\Movies");
|
|
|
|
Mocker.GetMock<IDiskProvider>()
|
|
.Setup(s => s.FolderExists(It.IsAny<string>()))
|
|
.Returns(false);
|
|
}
|
|
|
|
[Test]
|
|
public void should_not_return_error_when_no_movie()
|
|
{
|
|
Mocker.GetMock<IMovieService>()
|
|
.Setup(s => s.AllMoviePaths())
|
|
.Returns(new List<string>());
|
|
|
|
Subject.Check().ShouldBeOk();
|
|
}
|
|
|
|
[Test]
|
|
public void should_return_error_if_movie_parent_is_missing()
|
|
{
|
|
GivenMissingRootFolder();
|
|
|
|
Subject.Check().ShouldBeError();
|
|
}
|
|
}
|
|
}
|