mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-18 21:34:28 -04:00
Xem cleanup.
This commit is contained in:
@@ -165,6 +165,7 @@
|
||||
<Compile Include="OrganizerTests\BuildFilePathFixture.cs" />
|
||||
<Compile Include="ParserTests\ParsingServiceTests\GetEpisodesFixture.cs" />
|
||||
<Compile Include="ParserTests\ParsingServiceTests\MapFixture.cs" />
|
||||
<Compile Include="Providers\XemProxyFixture.cs" />
|
||||
<Compile Include="Qualities\QualitySizeRepositoryFixture.cs" />
|
||||
<Compile Include="Qualities\QualityProfileRepositoryFixture.cs" />
|
||||
<Compile Include="RootFolderTests\FreeSpaceOnDrivesFixture.cs" />
|
||||
@@ -198,7 +199,6 @@
|
||||
<Compile Include="TvTests\SeriesServiceTests\UpdateSeriesFixture.cs" />
|
||||
<Compile Include="UpdateTests\UpdateServiceFixture.cs" />
|
||||
<Compile Include="ProviderTests\XemCommunicationProviderTests\GetSceneTvdbMappingsFixture.cs" />
|
||||
<Compile Include="ProviderTests\XemCommunicationProviderTests\GetXemSeriesIdsFixture.cs" />
|
||||
<Compile Include="HelperTests\SortHelperTest.cs" />
|
||||
<Compile Include="DecisionEngineTests\AcceptableSizeSpecificationFixture.cs" />
|
||||
<Compile Include="Qualities\QualitySizeServiceFixture.cs" />
|
||||
|
||||
+9
-8
@@ -7,57 +7,58 @@ using NzbDrone.Common;
|
||||
using NzbDrone.Core.Providers;
|
||||
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Test.Common.Categories;
|
||||
|
||||
namespace NzbDrone.Core.Test.ProviderTests.XemCommunicationProviderTests
|
||||
{
|
||||
[TestFixture]
|
||||
|
||||
[IntegrationTest]
|
||||
public class GetSceneTvdbMappingsFixture : CoreTest
|
||||
{
|
||||
private void WithFailureJson()
|
||||
{
|
||||
Mocker.GetMock<IHttpProvider>().Setup(s => s.DownloadString(It.IsAny<String>()))
|
||||
.Returns(ReadAllText("Files","Xem","Failure.txt"));
|
||||
.Returns(ReadAllText("Files", "Xem", "Failure.txt"));
|
||||
}
|
||||
|
||||
private void WithIdsJson()
|
||||
{
|
||||
Mocker.GetMock<IHttpProvider>().Setup(s => s.DownloadString(It.IsAny<String>()))
|
||||
.Returns(ReadAllText("Files","Xem","Ids.txt"));
|
||||
.Returns(ReadAllText("Files", "Xem", "Ids.txt"));
|
||||
}
|
||||
|
||||
private void WithMappingsJson()
|
||||
{
|
||||
Mocker.GetMock<IHttpProvider>().Setup(s => s.DownloadString(It.IsAny<String>()))
|
||||
.Returns(ReadAllText("Files","Xem","Mappings.txt"));
|
||||
.Returns(ReadAllText("Files", "Xem", "Mappings.txt"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_throw_when_failure_is_found()
|
||||
{
|
||||
WithFailureJson();
|
||||
Assert.Throws<Exception>(() => Mocker.Resolve<XemCommunicationProvider>().GetSceneTvdbMappings(12345));
|
||||
Assert.Throws<Exception>(() => Mocker.Resolve<XemProxy>().GetSceneTvdbMappings(12345));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_get_list_of_mappings()
|
||||
{
|
||||
WithMappingsJson();
|
||||
Mocker.Resolve<XemCommunicationProvider>().GetSceneTvdbMappings(12345).Should().NotBeEmpty();
|
||||
Mocker.Resolve<XemProxy>().GetSceneTvdbMappings(12345).Should().NotBeEmpty();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_have_two_mappings()
|
||||
{
|
||||
WithMappingsJson();
|
||||
Mocker.Resolve<XemCommunicationProvider>().GetSceneTvdbMappings(12345).Should().HaveCount(2);
|
||||
Mocker.Resolve<XemProxy>().GetSceneTvdbMappings(12345).Should().HaveCount(2);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_have_expected_results()
|
||||
{
|
||||
WithMappingsJson();
|
||||
var results = Mocker.Resolve<XemCommunicationProvider>().GetSceneTvdbMappings(12345);
|
||||
var results = Mocker.Resolve<XemProxy>().GetSceneTvdbMappings(12345);
|
||||
var first = results.First();
|
||||
first.Scene.Absolute.Should().Be(1);
|
||||
first.Scene.Season.Should().Be(1);
|
||||
|
||||
-55
@@ -1,55 +0,0 @@
|
||||
using System;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Providers;
|
||||
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.ProviderTests.XemCommunicationProviderTests
|
||||
{
|
||||
[TestFixture]
|
||||
|
||||
public class GetXemSeriesIdsFixture : CoreTest
|
||||
{
|
||||
private void WithFailureJson()
|
||||
{
|
||||
Mocker.GetMock<IHttpProvider>().Setup(s => s.DownloadString(It.IsAny<String>()))
|
||||
.Returns(ReadAllText("Files", "Xem", "Failure.txt"));
|
||||
}
|
||||
|
||||
private void WithIdsJson()
|
||||
{
|
||||
Mocker.GetMock<IHttpProvider>().Setup(s => s.DownloadString(It.IsAny<String>()))
|
||||
.Returns(ReadAllText("Files", "Xem", "Ids.txt"));
|
||||
}
|
||||
|
||||
private void WithMappingsJson()
|
||||
{
|
||||
Mocker.GetMock<IHttpProvider>().Setup(s => s.DownloadString(It.IsAny<String>()))
|
||||
.Returns(ReadAllText("Files", "Xem", "Mappings.txt"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_throw_when_failure_is_found()
|
||||
{
|
||||
WithFailureJson();
|
||||
Assert.Throws<Exception>(() => Mocker.Resolve<XemCommunicationProvider>().GetXemSeriesIds());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_get_list_of_int()
|
||||
{
|
||||
WithIdsJson();
|
||||
Mocker.Resolve<XemCommunicationProvider>().GetXemSeriesIds().Should().NotBeEmpty();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_have_two_ids()
|
||||
{
|
||||
WithIdsJson();
|
||||
Mocker.Resolve<XemCommunicationProvider>().GetXemSeriesIds().Should().HaveCount(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Test.Common.Categories;
|
||||
|
||||
namespace NzbDrone.Core.Test.Providers
|
||||
{
|
||||
[TestFixture]
|
||||
[IntegrationTest]
|
||||
public class XemProxyFixture : CoreTest<XemProxy>
|
||||
{
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
UseRealHttp();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void get_series_ids()
|
||||
{
|
||||
Subject.GetXemSeriesIds().Should().NotBeEmpty();
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
[Ignore("XEM's data is not clean")]
|
||||
public void get_mapping_for_all_series()
|
||||
{
|
||||
var ids = Subject.GetXemSeriesIds();
|
||||
|
||||
var randomIds = ids.OrderBy(x => Guid.NewGuid()).Take(5);
|
||||
|
||||
foreach (var randomId in randomIds)
|
||||
{
|
||||
Subject.GetSceneTvdbMappings(randomId).Should().NotBeEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_throw_when_failure_is_found()
|
||||
{
|
||||
Assert.Throws<Exception>(() => Subject.GetSceneTvdbMappings(12345));
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void should_get_mapping()
|
||||
{
|
||||
var result = Subject.GetSceneTvdbMappings(82807);
|
||||
|
||||
result.Should().NotBeEmpty();
|
||||
result.Should().OnlyContain(c => c.Scene != null);
|
||||
result.Should().OnlyContain(c => c.Tvdb != null);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user