1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-21 01:49:57 +02:00
Sonarr/NzbDrone.Integration.Test/SeriesIntegrationTest.cs

71 lines
1.7 KiB
C#
Raw Normal View History

using System.Net;
2013-04-21 01:14:41 +03:00
using FluentAssertions;
2013-04-19 07:46:18 +03:00
using NUnit.Framework;
using NzbDrone.Api.Series;
using System.Linq;
using NzbDrone.Test.Common;
2013-04-19 07:46:18 +03:00
namespace NzbDrone.Integration.Test
{
[TestFixture]
public class SeriesIntegrationTest : IntegrationTest
2013-04-19 07:46:18 +03:00
{
[Test]
public void series_lookup_on_trakt()
{
var series = Series.Lookup("archer");
series.Should().NotBeEmpty();
series.Should().Contain(c => c.Title == "Archer (2009)");
}
[Test]
2013-04-21 01:14:41 +03:00
public void add_series_without_required_fields_should_return_badrequest()
2013-04-19 07:46:18 +03:00
{
2013-04-21 01:14:41 +03:00
var errors = Series.InvalidPost(new SeriesResource());
errors.Should().NotBeEmpty();
2013-04-19 07:46:18 +03:00
}
[Test]
public void should_be_able_to_add_and_delete_series()
{
var series = Series.Lookup("archer").First();
series.QualityProfileId = 1;
series.Path = @"C:\Test\Archer".AsOsAgnostic();
2013-04-22 10:21:39 +03:00
series = Series.Post(series);
Series.All().Should().HaveCount(1);
2013-05-04 05:42:11 +03:00
Series.Get(series.Id).Should().NotBeNull();
Series.Delete(series.Id);
Series.All().Should().BeEmpty();
}
2013-05-04 05:42:11 +03:00
[Test]
public void should_be_able_to_find_series_by_id()
{
var series = Series.Lookup("90210").First();
series.QualityProfileId = 1;
series.Path = @"C:\Test\90210".AsOsAgnostic();
series = Series.Post(series);
Series.All().Should().HaveCount(1);
Series.Get(series.Id).Should().NotBeNull();
}
2013-05-04 05:42:11 +03:00
[Test]
public void invalid_id_should_return_404()
{
Series.Get(99, HttpStatusCode.NotFound);
}
2013-04-19 07:46:18 +03:00
}
}