Replaced Nancy.Hosting.Self with Owin

SignalR to come!
This commit is contained in:
kay.one 2013-05-04 13:29:24 -07:00
commit 2ec79e6744
9 changed files with 96 additions and 42 deletions

View file

@ -1,13 +1,12 @@
using System;
using System.IO;
using Moq;
using NLog;
using NLog.Config;
using NLog.Targets;
using NUnit.Framework;
using Nancy.Hosting.Self;
using NzbDrone.Api;
using NzbDrone.Api.Commands;
using NzbDrone.Api.Indexers;
using NzbDrone.Api.RootFolders;
using NzbDrone.Common;
using NzbDrone.Core.Datastore;
@ -21,7 +20,7 @@ namespace NzbDrone.Integration.Test
public abstract class IntegrationTest
{
private NancyBootstrapper _bootstrapper;
private NancyHost _host;
private IHostController _hostController;
protected RestClient RestClient { get; private set; }
private static readonly Logger Logger = LogManager.GetLogger("TEST");
@ -82,24 +81,27 @@ namespace NzbDrone.Integration.Test
_bootstrapper = new NancyBootstrapper(Container);
const string url = "http://localhost:1313";
_host = new NancyHost(new Uri(url), _bootstrapper);
var _hostConfig = new Mock<ConfigFileProvider>();
_hostConfig.SetupGet(c => c.Port).Returns(1313);
RestClient = new RestClient(url + "/api/");
_hostController = new OwinHostController(_hostConfig.Object, _bootstrapper, Logger);
RestClient = new RestClient(_hostController.AppUrl + "/api/");
Series = new SeriesClient(RestClient);
Releases = new ReleaseClient(RestClient);
RootFolders = new ClientBase<RootFolderResource>(RestClient);
Commands = new ClientBase<CommandResource>(RestClient);
Indexers = new IndexerClient(RestClient);
_host.Start();
_hostController.StartServer();
}
[TearDown]
public void SmokeTestTearDown()
{
_host.Stop();
_hostController.StopServer();
_bootstrapper.Shutdown();
}

View file

@ -40,11 +40,23 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\FluentValidation.4.0.0.0\lib\Net40\FluentValidation.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Owin.Host.HttpListener">
<HintPath>..\packages\Microsoft.Owin.Host.HttpListener.0.21.0-pre\lib\net40\Microsoft.Owin.Host.HttpListener.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Owin.Hosting, Version=0.21.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Microsoft.Owin.Hosting.0.21.0-pre\lib\net40\Microsoft.Owin.Hosting.dll</HintPath>
</Reference>
<Reference Include="Moq, Version=4.0.10827.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Moq.4.0.10827\lib\NET40\Moq.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 Include="Nancy.Owin, Version=0.16.1.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Nancy.Owin.0.16.1\lib\net40\Nancy.Owin.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>..\packages\Newtonsoft.Json.5.0.3\lib\net35\Newtonsoft.Json.dll</HintPath>
@ -55,6 +67,10 @@
<Reference Include="nunit.framework">
<HintPath>..\packages\NUnit.2.6.2\lib\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
</Reference>
<Reference Include="RestSharp">
<HintPath>..\packages\RestSharp.104.1\lib\net4\RestSharp.dll</HintPath>
</Reference>

View file

@ -62,5 +62,12 @@ namespace NzbDrone.Integration.Test
Series.Get("non-existing-slug", HttpStatusCode.NotFound);
}
[Test]
[Ignore]
public void invalid_id_should_return_404()
{
//TODO: fix
Series.Get(99, HttpStatusCode.NotFound);
}
}
}

View file

@ -2,10 +2,14 @@
<packages>
<package id="FluentAssertions" version="2.0.1" targetFramework="net40" />
<package id="FluentValidation" version="4.0.0.0" targetFramework="net40" />
<package id="Microsoft.Owin.Host.HttpListener" version="0.21.0-pre" targetFramework="net40" />
<package id="Microsoft.Owin.Hosting" version="0.21.0-pre" targetFramework="net40" />
<package id="Moq" version="4.0.10827" targetFramework="net40" />
<package id="Nancy" version="0.16.1" targetFramework="net40" />
<package id="Nancy.Hosting.Self" version="0.16.1" targetFramework="net40" />
<package id="Nancy.Owin" 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="Owin" version="1.0" targetFramework="net40" />
<package id="RestSharp" version="104.1" targetFramework="net40" />
</packages>