QualityType added to database to allow saving of size limits. Fluent now uses longs for multiplication, to ensure it doesn't overflow.pull/4/head
parent
f8ae95d36f
commit
e4f01ae0d4
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<generator>NZBMatrix.com RSS 2.0</generator>
|
||||
<language>en</language>
|
||||
<title>NZBMatrix</title>
|
||||
<description>NZBMatrix.com RSS Feed - Usenet</description>
|
||||
<link>http://nzbmatrix.com</link>
|
||||
|
||||
<copyright>Copyright 2011 NZBMatrix</copyright>
|
||||
<pubDate>Wed, 14 Sep 2011 02:18:04 +0200</pubDate>
|
||||
<item>
|
||||
<title>House S04E11 720p HDTV x264 BAWLS</title>
|
||||
<guid>http://nzbmatrix.com/nzb-details.php?id=914522&hit=1</guid>
|
||||
<link>http://nzbmatrix.com/nzb-details.php?id=914522&hit=1</link>
|
||||
<description><![CDATA[<b>Name:</b> House S04E11 FRENCH 720p HDTV x264 BAWLS<br /><b>Category:</b> TV: HD<br /><b>Size:</b> 1.24 GB<br /><b>Added:</b> 2011-04-25 15:06:58<br /><b>Group:</b> alt.binaries.multimedia <BR /><b>NFO:</b> <a href="http://nzbmatrix.com/viewnfo.php?id=914522">View NFO</a> ]]></description>
|
||||
<category>TV: HD</category>
|
||||
<cattext>tv.hd</cattext>
|
||||
<categoryid>41</categoryid>
|
||||
<enclosure url="http://nzbmatrix.com/nzb-details.php?id=914522&hit=1" length="1335801937" type="application/x-nzb" />
|
||||
</item>
|
||||
</channel>
|
||||
</rss>
|
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1" ?>
|
||||
<rss version="2.0">
|
||||
<channel>
|
||||
<title>NZBsRus.com</title>
|
||||
<description>This is the NZBs'R'US RSS feed.</description>
|
||||
<link>http://www.nzbsrus.com</link>
|
||||
<language>en-US</language>
|
||||
<ttl>5</ttl>
|
||||
|
||||
<item>
|
||||
<title>Shameless.S08E17.720p.HDTV.x264-BiA</title>
|
||||
<pubDate>Wed, 14 Sep 2011 01:06:49 am</pubDate>
|
||||
<category>TV - HD</category>
|
||||
<link>http://www.nzbsrus.com/nzbdownload_rss.php/457967/68614/4182562f71f29cd36b9e7495d00abcff/</link>
|
||||
<description>
|
||||
Size 1.67 GiB (42 files)
|
||||
Files: 34
|
||||
Par2s: 8
|
||||
|
||||
</description>
|
||||
</item>
|
||||
</channel>
|
||||
</rss>
|
@ -0,0 +1,105 @@
|
||||
// ReSharper disable RedundantUsingDirective
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using AutoMoq;
|
||||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Repository;
|
||||
using NzbDrone.Core.Repository.Quality;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
public class QualityTypeProviderTest : TestBase
|
||||
{
|
||||
[Test]
|
||||
public void SetupDefault_should_add_six_profiles()
|
||||
{
|
||||
var mocker = new AutoMoqer();
|
||||
var db = MockLib.GetEmptyDatabase();
|
||||
mocker.SetConstant(db);
|
||||
|
||||
//Act
|
||||
mocker.Resolve<QualityTypeProvider>().SetupDefault();
|
||||
|
||||
//Assert
|
||||
var types = mocker.Resolve<QualityTypeProvider>().All();
|
||||
|
||||
types.Should().HaveCount(6);
|
||||
types.Should().Contain(e => e.Name == "SDTV" && e.QualityTypeId == 1);
|
||||
types.Should().Contain(e => e.Name == "DVD" && e.QualityTypeId == 2);
|
||||
types.Should().Contain(e => e.Name == "HDTV" && e.QualityTypeId == 4);
|
||||
types.Should().Contain(e => e.Name == "WEBDL" && e.QualityTypeId == 5);
|
||||
types.Should().Contain(e => e.Name == "Bluray720p" && e.QualityTypeId == 6);
|
||||
types.Should().Contain(e => e.Name == "Bluray1080p" && e.QualityTypeId == 7);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SetupDefault_already_exists()
|
||||
{
|
||||
var mocker = new AutoMoqer();
|
||||
var db = MockLib.GetEmptyDatabase();
|
||||
mocker.SetConstant(db);
|
||||
|
||||
var fakeQualityType = Builder<QualityType>.CreateNew()
|
||||
.Build();
|
||||
|
||||
db.Insert(fakeQualityType);
|
||||
|
||||
//Act
|
||||
mocker.Resolve<QualityTypeProvider>().SetupDefault();
|
||||
|
||||
//Assert
|
||||
var types = mocker.Resolve<QualityTypeProvider>().All();
|
||||
|
||||
types.Should().HaveCount(1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetList_single_quality_type()
|
||||
{
|
||||
var mocker = new AutoMoqer();
|
||||
var db = MockLib.GetEmptyDatabase();
|
||||
mocker.SetConstant(db);
|
||||
|
||||
var fakeQualityTypes = Builder<QualityType>.CreateListOfSize(6)
|
||||
.Build();
|
||||
|
||||
var ids = new List<int> { 1 };
|
||||
|
||||
db.InsertMany(fakeQualityTypes);
|
||||
|
||||
//Act
|
||||
var result = mocker.Resolve<QualityTypeProvider>().GetList(ids);
|
||||
|
||||
//Assert
|
||||
result.Should().HaveCount(ids.Count);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetList_multiple_quality_type()
|
||||
{
|
||||
var mocker = new AutoMoqer();
|
||||
var db = MockLib.GetEmptyDatabase();
|
||||
mocker.SetConstant(db);
|
||||
|
||||
var fakeQualityTypes = Builder<QualityType>.CreateListOfSize(6)
|
||||
.Build();
|
||||
|
||||
var ids = new List<int> { 1, 2 };
|
||||
|
||||
db.InsertMany(fakeQualityTypes);
|
||||
|
||||
//Act
|
||||
var result = mocker.Resolve<QualityTypeProvider>().GetList(ids);
|
||||
|
||||
//Assert
|
||||
result.Should().HaveCount(ids.Count);
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
Loading…
Reference in new issue