moved seriesmodule to restmodule

This commit is contained in:
kay.one 2013-04-20 15:14:41 -07:00
commit d85b825e06
11 changed files with 142 additions and 43 deletions

View file

@ -1,7 +1,10 @@
using System.Collections.Generic;
using System.Net;
using FluentAssertions;
using FluentValidation;
using FluentValidation.Results;
using NLog;
using Newtonsoft.Json;
using RestSharp;
namespace NzbDrone.Integration.Test.Client
@ -33,6 +36,13 @@ namespace NzbDrone.Integration.Test.Client
return Post<TResource>(request);
}
public List<string> InvalidPost(TResource body)
{
var request = BuildRequest();
request.AddBody(body);
return Post<List<string>>(request, HttpStatusCode.BadRequest);
}
protected RestRequest BuildRequest(string command = "")
{
return new RestRequest(_resource + "/" + command.Trim('/'))
@ -58,9 +68,10 @@ namespace NzbDrone.Integration.Test.Client
_logger.Info("{0}: {1}", request.Method, _restClient.BuildUri(request));
var response = _restClient.Execute<T>(request);
_logger.Info("Response: {0}", response.Content);
response.StatusCode.Should().Be(statusCode);
if (response.ErrorException != null)
{
throw response.ErrorException;
@ -68,9 +79,6 @@ namespace NzbDrone.Integration.Test.Client
response.ErrorMessage.Should().BeBlank();
response.StatusCode.Should().Be(statusCode);
return response.Data;
}

View file

@ -42,12 +42,20 @@
<Reference Include="FluentAssertions">
<HintPath>..\packages\FluentAssertions.2.0.1\lib\net40\FluentAssertions.dll</HintPath>
</Reference>
<Reference Include="FluentValidation, Version=3.4.6.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\FluentValidation.3.4.6.0\lib\Net40\FluentValidation.dll</HintPath>
</Reference>
<Reference Include="Nancy">
<HintPath>..\packages\Nancy.0.16.1\lib\net40\Nancy.dll</HintPath>
</Reference>
<Reference Include="Nancy.Hosting.Self">
<HintPath>..\packages\Nancy.Hosting.Self.0.16.1\lib\net40\Nancy.Hosting.Self.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Newtonsoft.Json.5.0.3\lib\net40\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="NLog">
<HintPath>..\packages\NLog.2.0.1.2\lib\net40\NLog.dll</HintPath>
</Reference>

View file

@ -1,4 +1,5 @@
using FluentAssertions;
using System.Net;
using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Api.Series;
@ -23,10 +24,10 @@ namespace NzbDrone.Integration.Test
}
[Test]
[Ignore]
public void add_series_without_required_fields_should_return_400()
public void add_series_without_required_fields_should_return_badrequest()
{
Series.Post(new SeriesResource());
var errors = Series.InvalidPost(new SeriesResource());
errors.Should().NotBeEmpty();
}
}

View file

@ -3,8 +3,10 @@
<package id="Exceptron.Client" version="1.0.20" targetFramework="net40" />
<package id="Exceptron.NLog" version="1.0.11" targetFramework="net40" />
<package id="FluentAssertions" version="2.0.1" targetFramework="net40" />
<package id="FluentValidation" version="3.4.6.0" targetFramework="net40" />
<package id="Nancy" version="0.16.1" targetFramework="net40" />
<package id="Nancy.Hosting.Self" version="0.16.1" targetFramework="net40" />
<package id="Newtonsoft.Json" version="5.0.3" targetFramework="net40" />
<package id="NLog" version="2.0.1.2" targetFramework="net40" />
<package id="NUnit" version="2.6.2" targetFramework="net40" />
<package id="RestSharp" version="104.1" targetFramework="net40" />