From b3c9217412b80ede711eb97ff960d58969d1ced8 Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Tue, 10 Sep 2013 00:01:27 -0700 Subject: [PATCH] improved clone injection. --- NzbDrone.Api/Mapping/CloneInjection.cs | 3 ++- NzbDrone.Integration.Test/Client/ClientBase.cs | 4 ++-- NzbDrone.Integration.Test/HistoryIntegrationTest.cs | 6 ++++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/NzbDrone.Api/Mapping/CloneInjection.cs b/NzbDrone.Api/Mapping/CloneInjection.cs index 71bbd4bbe..1266ebd0b 100644 --- a/NzbDrone.Api/Mapping/CloneInjection.cs +++ b/NzbDrone.Api/Mapping/CloneInjection.cs @@ -17,9 +17,10 @@ protected override bool Match(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; + if (conventionInfo.SourceProp.Type.IsArray) { var array = (Array)conventionInfo.SourceProp.Value; diff --git a/NzbDrone.Integration.Test/Client/ClientBase.cs b/NzbDrone.Integration.Test/Client/ClientBase.cs index 16aff68eb..20e35117f 100644 --- a/NzbDrone.Integration.Test/Client/ClientBase.cs +++ b/NzbDrone.Integration.Test/Client/ClientBase.cs @@ -86,7 +86,7 @@ public List InvalidPost(TResource body) return Post>(request, HttpStatusCode.BadRequest); } - protected RestRequest BuildRequest(string command = "") + public RestRequest BuildRequest(string command = "") { return new RestRequest(_resource + "/" + command.Trim('/')) { @@ -94,7 +94,7 @@ protected RestRequest BuildRequest(string command = "") }; } - protected T Get(IRestRequest request, HttpStatusCode statusCode = HttpStatusCode.OK) where T : class, new() + public T Get(IRestRequest request, HttpStatusCode statusCode = HttpStatusCode.OK) where T : class, new() { request.Method = Method.GET; return Execute(request, statusCode); diff --git a/NzbDrone.Integration.Test/HistoryIntegrationTest.cs b/NzbDrone.Integration.Test/HistoryIntegrationTest.cs index 0fce0d308..d4c56b4b2 100644 --- a/NzbDrone.Integration.Test/HistoryIntegrationTest.cs +++ b/NzbDrone.Integration.Test/HistoryIntegrationTest.cs @@ -1,5 +1,7 @@ -using FluentAssertions; +using System.Net; +using FluentAssertions; using NUnit.Framework; +using NzbDrone.Api.History; namespace NzbDrone.Integration.Test { @@ -9,7 +11,7 @@ public class HistoryIntegrationTest : IntegrationTest [Test] 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.Page.Should().Be(1);