|
|
|
@ -26,7 +26,7 @@ namespace NzbDrone.Core.Test.Profiles
|
|
|
|
|
|
|
|
|
|
Subject.Handle(new ApplicationStartedEvent());
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IProfileRepository>()
|
|
|
|
|
Mocker.GetMock<IQualityProfileRepository>()
|
|
|
|
|
.Verify(v => v.Insert(It.IsAny<QualityProfile>()), Times.Exactly(3));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -36,13 +36,13 @@ namespace NzbDrone.Core.Test.Profiles
|
|
|
|
|
// We don't want to keep adding them back if a user deleted them on purpose.
|
|
|
|
|
public void Init_should_skip_if_any_profiles_already_exist()
|
|
|
|
|
{
|
|
|
|
|
Mocker.GetMock<IProfileRepository>()
|
|
|
|
|
Mocker.GetMock<IQualityProfileRepository>()
|
|
|
|
|
.Setup(s => s.All())
|
|
|
|
|
.Returns(Builder<QualityProfile>.CreateListOfSize(2).Build().ToList());
|
|
|
|
|
|
|
|
|
|
Subject.Handle(new ApplicationStartedEvent());
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IProfileRepository>()
|
|
|
|
|
Mocker.GetMock<IQualityProfileRepository>()
|
|
|
|
|
.Verify(v => v.Insert(It.IsAny<QualityProfile>()), Times.Never());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -71,11 +71,11 @@ namespace NzbDrone.Core.Test.Profiles
|
|
|
|
|
Mocker.GetMock<IArtistService>().Setup(c => c.GetAllArtists()).Returns(artistList);
|
|
|
|
|
Mocker.GetMock<IImportListFactory>().Setup(c => c.All()).Returns(importLists);
|
|
|
|
|
Mocker.GetMock<IRootFolderService>().Setup(c => c.All()).Returns(rootFolders);
|
|
|
|
|
Mocker.GetMock<IProfileRepository>().Setup(c => c.Get(profile.Id)).Returns(profile);
|
|
|
|
|
Mocker.GetMock<IQualityProfileRepository>().Setup(c => c.Get(profile.Id)).Returns(profile);
|
|
|
|
|
|
|
|
|
|
Assert.Throws<QualityProfileInUseException>(() => Subject.Delete(profile.Id));
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IProfileRepository>().Verify(c => c.Delete(It.IsAny<int>()), Times.Never());
|
|
|
|
|
Mocker.GetMock<IQualityProfileRepository>().Verify(c => c.Delete(It.IsAny<int>()), Times.Never());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
@ -103,11 +103,11 @@ namespace NzbDrone.Core.Test.Profiles
|
|
|
|
|
Mocker.GetMock<IArtistService>().Setup(c => c.GetAllArtists()).Returns(artistList);
|
|
|
|
|
Mocker.GetMock<IImportListFactory>().Setup(c => c.All()).Returns(importLists);
|
|
|
|
|
Mocker.GetMock<IRootFolderService>().Setup(c => c.All()).Returns(rootFolders);
|
|
|
|
|
Mocker.GetMock<IProfileRepository>().Setup(c => c.Get(profile.Id)).Returns(profile);
|
|
|
|
|
Mocker.GetMock<IQualityProfileRepository>().Setup(c => c.Get(profile.Id)).Returns(profile);
|
|
|
|
|
|
|
|
|
|
Assert.Throws<QualityProfileInUseException>(() => Subject.Delete(profile.Id));
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IProfileRepository>().Verify(c => c.Delete(It.IsAny<int>()), Times.Never());
|
|
|
|
|
Mocker.GetMock<IQualityProfileRepository>().Verify(c => c.Delete(It.IsAny<int>()), Times.Never());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
@ -135,11 +135,11 @@ namespace NzbDrone.Core.Test.Profiles
|
|
|
|
|
Mocker.GetMock<IArtistService>().Setup(c => c.GetAllArtists()).Returns(artistList);
|
|
|
|
|
Mocker.GetMock<IImportListFactory>().Setup(c => c.All()).Returns(importLists);
|
|
|
|
|
Mocker.GetMock<IRootFolderService>().Setup(c => c.All()).Returns(rootFolders);
|
|
|
|
|
Mocker.GetMock<IProfileRepository>().Setup(c => c.Get(profile.Id)).Returns(profile);
|
|
|
|
|
Mocker.GetMock<IQualityProfileRepository>().Setup(c => c.Get(profile.Id)).Returns(profile);
|
|
|
|
|
|
|
|
|
|
Assert.Throws<QualityProfileInUseException>(() => Subject.Delete(profile.Id));
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IProfileRepository>().Verify(c => c.Delete(It.IsAny<int>()), Times.Never());
|
|
|
|
|
Mocker.GetMock<IQualityProfileRepository>().Verify(c => c.Delete(It.IsAny<int>()), Times.Never());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
@ -166,7 +166,7 @@ namespace NzbDrone.Core.Test.Profiles
|
|
|
|
|
|
|
|
|
|
Subject.Delete(1);
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IProfileRepository>().Verify(c => c.Delete(1), Times.Once());
|
|
|
|
|
Mocker.GetMock<IQualityProfileRepository>().Verify(c => c.Delete(1), Times.Once());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|