mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 18:57:39 -07:00
added open generic registration for simple repository, services can now use simple repository independently.
This commit is contained in:
parent
63cf7a3b85
commit
e7deda4d5d
9 changed files with 28 additions and 45 deletions
|
@ -8,6 +8,7 @@ using FluentAssertions;
|
|||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.RootFolders;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Test.Common;
|
||||
|
@ -21,7 +22,7 @@ namespace NzbDrone.Core.Test.RootFolderTests
|
|||
[Test]
|
||||
public void should_return_one_drive_when_only_one_root_dir_exists()
|
||||
{
|
||||
Mocker.GetMock<IRootFolderRepository>()
|
||||
Mocker.GetMock<IBasicRepository<RootFolder>>()
|
||||
.Setup(s => s.All())
|
||||
.Returns(new List<RootFolder> { new RootFolder { OID = 1, Path = @"C:\Test\TV" } });
|
||||
|
||||
|
@ -41,7 +42,7 @@ namespace NzbDrone.Core.Test.RootFolderTests
|
|||
[Test]
|
||||
public void should_return_one_drive_when_two_rootDirs_on_the_same_drive_exist()
|
||||
{
|
||||
Mocker.GetMock<IRootFolderRepository>()
|
||||
Mocker.GetMock<IBasicRepository<RootFolder>>()
|
||||
.Setup(s => s.All())
|
||||
.Returns(new List<RootFolder> { new RootFolder { OID = 1, Path = @"C:\Test\TV" },
|
||||
new RootFolder { OID = 2, Path = @"C:\Test\TV2" }});
|
||||
|
@ -62,7 +63,7 @@ namespace NzbDrone.Core.Test.RootFolderTests
|
|||
[Test]
|
||||
public void should_return_two_drives_when_two_rootDirs_on_the_different_drive_exist()
|
||||
{
|
||||
Mocker.GetMock<IRootFolderRepository>()
|
||||
Mocker.GetMock<IBasicRepository<RootFolder>>()
|
||||
.Setup(s => s.All())
|
||||
.Returns(new List<RootFolder> { new RootFolder { OID = 1, Path = @"C:\Test\TV" },
|
||||
new RootFolder { OID = 2, Path = @"D:\Test\TV" }});
|
||||
|
@ -87,7 +88,7 @@ namespace NzbDrone.Core.Test.RootFolderTests
|
|||
[Test]
|
||||
public void should_skip_rootDir_if_not_found_on_disk()
|
||||
{
|
||||
Mocker.GetMock<IRootFolderRepository>()
|
||||
Mocker.GetMock<IBasicRepository<RootFolder>>()
|
||||
.Setup(s => s.All())
|
||||
.Returns(new List<RootFolder> { new RootFolder { OID = 1, Path = @"C:\Test\TV" } });
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ using FluentAssertions;
|
|||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.RootFolders;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
|
@ -24,7 +25,7 @@ namespace NzbDrone.Core.Test.RootFolderTests
|
|||
.Setup(m => m.FolderExists(It.IsAny<string>()))
|
||||
.Returns(true);
|
||||
|
||||
Mocker.GetMock<IRootFolderRepository>()
|
||||
Mocker.GetMock<IBasicRepository<RootFolder>>()
|
||||
.Setup(s => s.All())
|
||||
.Returns(new List<RootFolder>());
|
||||
}
|
||||
|
@ -44,7 +45,7 @@ namespace NzbDrone.Core.Test.RootFolderTests
|
|||
|
||||
Subject.Add(root);
|
||||
|
||||
Mocker.GetMock<IRootFolderRepository>().Verify(c => c.Add(root), Times.Once());
|
||||
Mocker.GetMock<IBasicRepository<RootFolder>>().Verify(c => c.Add(root), Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -59,14 +60,14 @@ namespace NzbDrone.Core.Test.RootFolderTests
|
|||
public void should_be_able_to_remove_root_dir()
|
||||
{
|
||||
Subject.Remove(1);
|
||||
Mocker.GetMock<IRootFolderRepository>().Verify(c => c.Delete(1), Times.Once());
|
||||
Mocker.GetMock<IBasicRepository<RootFolder>>().Verify(c => c.Delete(1), Times.Once());
|
||||
}
|
||||
|
||||
public void None_existing_folder_returns_empty_list()
|
||||
{
|
||||
WithNoneExistingFolder();
|
||||
|
||||
Mocker.GetMock<IRootFolderRepository>().Setup(c => c.All()).Returns(new List<RootFolder>());
|
||||
Mocker.GetMock<IBasicRepository<RootFolder>>().Setup(c => c.All()).Returns(new List<RootFolder>());
|
||||
|
||||
const string path = "d:\\bad folder";
|
||||
|
||||
|
@ -96,7 +97,7 @@ namespace NzbDrone.Core.Test.RootFolderTests
|
|||
[Test]
|
||||
public void adding_duplicated_root_folder_should_throw()
|
||||
{
|
||||
Mocker.GetMock<IRootFolderRepository>().Setup(c => c.All()).Returns(new List<RootFolder> { new RootFolder { Path = "C:\\TV" } });
|
||||
Mocker.GetMock<IBasicRepository<RootFolder>>().Setup(c => c.All()).Returns(new List<RootFolder> { new RootFolder { Path = "C:\\TV" } });
|
||||
|
||||
Assert.Throws<InvalidOperationException>(() => Subject.Add(new RootFolder { Path = @"C:\TV" }));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue