2013-09-12 22:42:01 +00:00
|
|
|
|
using System.Linq;
|
2013-09-05 00:06:24 +00:00
|
|
|
|
using FizzWare.NBuilder;
|
|
|
|
|
using FluentAssertions;
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using NzbDrone.Core.Datastore.Migration.Framework;
|
|
|
|
|
using NzbDrone.Core.Test.Framework;
|
|
|
|
|
using NzbDrone.Core.Tv;
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Test.Datastore.SQLiteMigrationHelperTests
|
|
|
|
|
{
|
|
|
|
|
[TestFixture]
|
|
|
|
|
public class DuplicateFixture : DbTest
|
|
|
|
|
{
|
|
|
|
|
private SqLiteMigrationHelper _subject;
|
|
|
|
|
|
|
|
|
|
[SetUp]
|
|
|
|
|
public void SetUp()
|
|
|
|
|
{
|
|
|
|
|
_subject = Mocker.Resolve<SqLiteMigrationHelper>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void get_duplicates()
|
|
|
|
|
{
|
|
|
|
|
var series = Builder<Series>.CreateListOfSize(10)
|
|
|
|
|
.Random(3)
|
|
|
|
|
.With(c => c.QualityProfileId = 100)
|
|
|
|
|
.BuildListOfNew();
|
|
|
|
|
|
|
|
|
|
Db.InsertMany(series);
|
|
|
|
|
|
|
|
|
|
var duplicates = _subject.GetDuplicates<int>("series", "QualityProfileId").ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
duplicates.Should().HaveCount(1);
|
|
|
|
|
duplicates.First().Should().HaveCount(3);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|