2013-02-27 04:19:22 +01:00
|
|
|
using System.Collections.Generic;
|
|
|
|
using Moq;
|
|
|
|
using NUnit.Framework;
|
2013-04-13 01:28:05 +02:00
|
|
|
using NzbDrone.Core.Lifecycle;
|
2013-02-27 04:19:22 +01:00
|
|
|
using NzbDrone.Core.Qualities;
|
|
|
|
using NzbDrone.Core.Test.Framework;
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Test.Qualities
|
|
|
|
{
|
|
|
|
[TestFixture]
|
2013-05-31 03:43:13 +02:00
|
|
|
|
2013-02-27 04:19:22 +01:00
|
|
|
public class QualitySizeServiceFixture : CoreTest<QualitySizeService>
|
|
|
|
{
|
|
|
|
[Test]
|
|
|
|
public void Init_should_add_all_sizes()
|
|
|
|
{
|
2013-04-13 01:28:05 +02:00
|
|
|
Subject.Handle(new ApplicationStartedEvent());
|
2013-05-31 03:43:13 +02:00
|
|
|
|
2013-02-27 04:19:22 +01:00
|
|
|
Mocker.GetMock<IQualitySizeRepository>()
|
2013-05-31 03:43:13 +02:00
|
|
|
.Verify(v => v.Insert(It.IsAny<QualitySize>()), Times.Exactly(Quality.All().Count));
|
2013-02-27 04:19:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void Init_should_insert_any_missing_sizes()
|
|
|
|
{
|
|
|
|
Mocker.GetMock<IQualitySizeRepository>()
|
|
|
|
.Setup(s => s.All())
|
|
|
|
.Returns(new List<QualitySize>
|
|
|
|
{
|
|
|
|
new QualitySize { QualityId = 1, Name = "SDTV", MinSize = 0, MaxSize = 100 }
|
|
|
|
});
|
|
|
|
|
2013-04-13 01:28:05 +02:00
|
|
|
Subject.Handle(new ApplicationStartedEvent());
|
2013-02-27 04:19:22 +01:00
|
|
|
|
|
|
|
Mocker.GetMock<IQualitySizeRepository>()
|
2013-05-31 03:43:13 +02:00
|
|
|
.Verify(v => v.Insert(It.IsAny<QualitySize>()), Times.Exactly(Quality.All().Count - 1));
|
2013-02-27 04:19:22 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|