mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-10-31 07:52:37 +01:00
44 lines
1.3 KiB
C#
44 lines
1.3 KiB
C#
// ReSharper disable RedundantUsingDirective
|
|
|
|
using System.Linq;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using FizzWare.NBuilder;
|
|
using FluentAssertions;
|
|
using Moq;
|
|
using NUnit.Framework;
|
|
using NzbDrone.Core.Qualities;
|
|
using NzbDrone.Core.Tv;
|
|
using NzbDrone.Core.Test.Framework;
|
|
|
|
namespace NzbDrone.Core.Test.Qualities
|
|
{
|
|
[TestFixture]
|
|
// ReSharper disable InconsistentNaming
|
|
public class QualityProfileFixture : CoreTest<QualityProfileService>
|
|
{
|
|
[Test]
|
|
public void Init_should_add_two_profiles()
|
|
{
|
|
Subject.Init();
|
|
|
|
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.Init();
|
|
|
|
Mocker.GetMock<IQualityProfileRepository>()
|
|
.Verify(v => v.Insert(It.IsAny<QualityProfile>()), Times.Never());
|
|
}
|
|
}
|
|
} |