You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Sonarr/NzbDrone.Core.Test/Qualities/QualityProfileFixture.cs

39 lines
1.2 KiB

using System.Linq;
using FizzWare.NBuilder;
using Moq;
using NUnit.Framework;
using NzbDrone.Core.Lifecycle;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.Qualities
{
[TestFixture]
12 years ago
public class QualityProfileFixture : CoreTest<QualityProfileService>
{
[Test]
public void Init_should_add_two_profiles()
{
Subject.Handle(new ApplicationStartedEvent());
Mocker.GetMock<IQualityProfileRepository>()
.Verify(v => v.Insert(It.IsAny<QualityProfile>()), Times.Exactly(2));
}
[Test]
//This confirms that new profiles are added only if no other profiles exists.
//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<IQualityProfileRepository>()
.Setup(s => s.All())
.Returns(Builder<QualityProfile>.CreateListOfSize(2).Build().ToList());
Subject.Handle(new ApplicationStartedEvent());
Mocker.GetMock<IQualityProfileRepository>()
.Verify(v => v.Insert(It.IsAny<QualityProfile>()), Times.Never());
}
}
}