mirror of
https://github.com/Sonarr/Sonarr.git
synced 2025-04-25 06:47:09 -04:00
Fix broken profile test
This commit is contained in:
parent
9e7f0c859f
commit
3f86c10c44
1 changed files with 8 additions and 3 deletions
|
@ -41,15 +41,20 @@ namespace NzbDrone.Core.Test.Profiles
|
||||||
[Test]
|
[Test]
|
||||||
public void should_not_be_able_to_delete_profile_if_assigned_to_series()
|
public void should_not_be_able_to_delete_profile_if_assigned_to_series()
|
||||||
{
|
{
|
||||||
|
var profile = Builder<Profile>.CreateNew()
|
||||||
|
.With(p => p.Id = 2)
|
||||||
|
.Build();
|
||||||
|
|
||||||
var seriesList = Builder<Series>.CreateListOfSize(3)
|
var seriesList = Builder<Series>.CreateListOfSize(3)
|
||||||
.Random(1)
|
.Random(1)
|
||||||
.With(c => c.ProfileId = 2)
|
.With(c => c.ProfileId = profile.Id)
|
||||||
.Build().ToList();
|
.Build().ToList();
|
||||||
|
|
||||||
|
|
||||||
Mocker.GetMock<ISeriesService>().Setup(c => c.GetAllSeries()).Returns(seriesList);
|
Mocker.GetMock<ISeriesService>().Setup(c => c.GetAllSeries()).Returns(seriesList);
|
||||||
|
Mocker.GetMock<IProfileRepository>().Setup(c => c.Get(profile.Id)).Returns(profile);
|
||||||
|
|
||||||
Assert.Throws<ProfileInUseException>(() => Subject.Delete(2));
|
Assert.Throws<ProfileInUseException>(() => Subject.Delete(profile.Id));
|
||||||
|
|
||||||
Mocker.GetMock<IProfileRepository>().Verify(c => c.Delete(It.IsAny<int>()), Times.Never());
|
Mocker.GetMock<IProfileRepository>().Verify(c => c.Delete(It.IsAny<int>()), Times.Never());
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue