improved clone injection.

This commit is contained in:
kay.one 2013-09-10 00:01:27 -07:00
parent 0861e5f8c1
commit b3c9217412
3 changed files with 8 additions and 5 deletions

View File

@ -17,9 +17,10 @@ namespace NzbDrone.Api.Mapping
protected override object SetValue(ConventionInfo conventionInfo) protected override object SetValue(ConventionInfo conventionInfo)
{ {
if (conventionInfo.SourceProp.Type.IsValueType || conventionInfo.SourceProp.Type == typeof(string)) if (conventionInfo.SourceProp.Type == conventionInfo.TargetProp.Type)
return conventionInfo.SourceProp.Value; return conventionInfo.SourceProp.Value;
if (conventionInfo.SourceProp.Type.IsArray) if (conventionInfo.SourceProp.Type.IsArray)
{ {
var array = (Array)conventionInfo.SourceProp.Value; var array = (Array)conventionInfo.SourceProp.Value;

View File

@ -86,7 +86,7 @@ namespace NzbDrone.Integration.Test.Client
return Post<List<dynamic>>(request, HttpStatusCode.BadRequest); return Post<List<dynamic>>(request, HttpStatusCode.BadRequest);
} }
protected RestRequest BuildRequest(string command = "") public RestRequest BuildRequest(string command = "")
{ {
return new RestRequest(_resource + "/" + command.Trim('/')) return new RestRequest(_resource + "/" + command.Trim('/'))
{ {
@ -94,7 +94,7 @@ namespace NzbDrone.Integration.Test.Client
}; };
} }
protected T Get<T>(IRestRequest request, HttpStatusCode statusCode = HttpStatusCode.OK) where T : class, new() public T Get<T>(IRestRequest request, HttpStatusCode statusCode = HttpStatusCode.OK) where T : class, new()
{ {
request.Method = Method.GET; request.Method = Method.GET;
return Execute<T>(request, statusCode); return Execute<T>(request, statusCode);

View File

@ -1,5 +1,7 @@
using FluentAssertions; using System.Net;
using FluentAssertions;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Api.History;
namespace NzbDrone.Integration.Test namespace NzbDrone.Integration.Test
{ {
@ -9,7 +11,7 @@ namespace NzbDrone.Integration.Test
[Test] [Test]
public void history_should_be_empty() public void history_should_be_empty()
{ {
var history = History.GetPaged(1,15,"date","desc"); var history = History.GetPaged(1, 15, "date", "desc");
history.Records.Count.Should().Be(0); history.Records.Count.Should().Be(0);
history.Page.Should().Be(1); history.Page.Should().Be(1);