You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.6 KiB
55 lines
1.6 KiB
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);
|
|
}
|
|
}
|
|
} |