|
|
|
@ -1,9 +1,11 @@
|
|
|
|
|
// ReSharper disable RedundantUsingDirective
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using AutoMoq;
|
|
|
|
|
using FizzWare.NBuilder;
|
|
|
|
|
using FluentAssertions;
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using NzbDrone.Core.Providers;
|
|
|
|
|
using NzbDrone.Core.Repository;
|
|
|
|
|
using NzbDrone.Core.Repository.Quality;
|
|
|
|
|
using NzbDrone.Core.Test.Framework;
|
|
|
|
@ -63,6 +65,39 @@ namespace NzbDrone.Core.Test
|
|
|
|
|
fetch.Allowed.Should().HaveCount(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void Update_Success()
|
|
|
|
|
{
|
|
|
|
|
//Arrange
|
|
|
|
|
var mocker = new AutoMoqer();
|
|
|
|
|
var db = MockLib.GetEmptyDatabase();
|
|
|
|
|
mocker.SetConstant(db);
|
|
|
|
|
|
|
|
|
|
var testProfile = new QualityProfile
|
|
|
|
|
{
|
|
|
|
|
Name = Guid.NewGuid().ToString(),
|
|
|
|
|
Cutoff = QualityTypes.SDTV
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
var id = Convert.ToInt32(db.Insert(testProfile));
|
|
|
|
|
var currentProfile = db.SingleOrDefault<QualityProfile>(id);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Update
|
|
|
|
|
currentProfile.Cutoff = QualityTypes.Bluray720p;
|
|
|
|
|
mocker.Resolve<QualityProvider>().Update(currentProfile);
|
|
|
|
|
|
|
|
|
|
var updated = mocker.Resolve<QualityProvider>().Get(currentProfile.QualityProfileId);
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
updated.Name.Should().Be(currentProfile.Name);
|
|
|
|
|
updated.Cutoff.Should().Be(QualityTypes.Bluray720p);
|
|
|
|
|
updated.AllowedString.Should().Be(currentProfile.AllowedString);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void Test_Series_Quality()
|
|
|
|
|
{
|
|
|
|
|