Skip to content

Commit

Permalink
Fixed broke tests caused by Nancy upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas Hovgaard committed Jul 5, 2013
1 parent ea6b63c commit 6856c47
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 69 deletions.
21 changes: 0 additions & 21 deletions src/Servant.Manager/app.config

This file was deleted.

10 changes: 0 additions & 10 deletions src/Servant.Manager/packages.config

This file was deleted.

25 changes: 0 additions & 25 deletions src/Servant.Manager/web.config

This file was deleted.

2 changes: 1 addition & 1 deletion src/Servant.Server/Bootstrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ protected override void ConfigureApplicationContainer(TinyIoCContainer container
base.ConfigureApplicationContainer(container);

var assembly = typeof(Servant.Web.Bootstrapper).Assembly;
ResourceViewLocationProvider.Ignore.Add(Assembly.Load("Nancy.ViewEngines.Razor, Version=0.16.1.0, Culture=neutral, PublicKeyToken=null"));
ResourceViewLocationProvider.Ignore.Add(Assembly.Load("Nancy.ViewEngines.Razor, Version=0.17.1.0, Culture=neutral, PublicKeyToken=null"));
ResourceViewLocationProvider.RootNamespaces.Clear();
ResourceViewLocationProvider.RootNamespaces.Add(assembly, "Servant.Web.Views");
}
Expand Down
17 changes: 17 additions & 0 deletions src/Servant.Web.Tests/Helpers/Bootstrapper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Nancy;
using Nancy.Testing.Fakes;

namespace Servant.Web.Tests.Helpers
{
public class Bootstrapper : Server.Bootstrapper
{
// Using this because http://stackoverflow.com/questions/15138994/sequence-contains-more-than-one-element-an-nancybootstrapperbase-class
protected override IRootPathProvider RootPathProvider
{
get
{
return new FakeRootPathProvider();
}
}
}
}
2 changes: 1 addition & 1 deletion src/Servant.Web.Tests/Helpers/BrowserBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class BrowserBuilder

public BrowserBuilder()
{
_bootstrapper = new Servant.Server.Bootstrapper();
_bootstrapper = new Bootstrapper();
}

public BrowserBuilder WithoutConfiguration()
Expand Down
16 changes: 10 additions & 6 deletions src/Servant.Web.Tests/Servant.Web.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,17 @@
<Reference Include="CsQuery">
<HintPath>..\packages\CsQuery.1.3.4\lib\net40\CsQuery.dll</HintPath>
</Reference>
<Reference Include="Nancy">
<HintPath>..\packages\Nancy.0.16.1\lib\net40\Nancy.dll</HintPath>
<Reference Include="Nancy, Version=0.17.1.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Nancy.0.17.1\lib\net40\Nancy.dll</HintPath>
</Reference>
<Reference Include="Nancy.Testing">
<HintPath>..\packages\Nancy.Testing.0.16.1\lib\net40\Nancy.Testing.dll</HintPath>
<Reference Include="Nancy.Testing, Version=0.17.1.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Nancy.Testing.0.17.1\lib\net40\Nancy.Testing.dll</HintPath>
</Reference>
<Reference Include="Nancy.Validation.DataAnnotations">
<HintPath>..\packages\Nancy.Validation.DataAnnotations.0.16.1\lib\net40\Nancy.Validation.DataAnnotations.dll</HintPath>
<Reference Include="Nancy.Validation.DataAnnotations, Version=0.17.1.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Nancy.Validation.DataAnnotations.0.17.1\lib\net40\Nancy.Validation.DataAnnotations.dll</HintPath>
</Reference>
<Reference Include="nunit.framework">
<HintPath>..\packages\NUnit.2.6.2\lib\nunit.framework.dll</HintPath>
Expand All @@ -54,6 +57,7 @@
<Reference Include="System.Data" />
</ItemGroup>
<ItemGroup>
<Compile Include="Helpers\Bootstrapper.cs" />
<Compile Include="Helpers\BrowserBuilder.cs" />
<Compile Include="Helpers\BrowserContextExtensions.cs" />
<Compile Include="HomeModuleTests.cs" />
Expand Down
6 changes: 3 additions & 3 deletions src/Servant.Web.Tests/packages.config
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="CsQuery" version="1.3.4" targetFramework="net45" />
<package id="Nancy" version="0.16.1" targetFramework="net45" />
<package id="Nancy.Testing" version="0.16.1" targetFramework="net45" />
<package id="Nancy.Validation.DataAnnotations" version="0.16.1" targetFramework="net45" />
<package id="Nancy" version="0.17.1" targetFramework="net45" />
<package id="Nancy.Testing" version="0.17.1" targetFramework="net45" />
<package id="Nancy.Validation.DataAnnotations" version="0.17.1" targetFramework="net45" />
<package id="NUnit" version="2.6.2" targetFramework="net45" />
</packages>
7 changes: 5 additions & 2 deletions src/Servant.Web/Modules/SitesModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -353,12 +353,15 @@ public void ValidateSiteApplications(Site site)
if (string.IsNullOrWhiteSpace(application.Path))
AddPropertyError("path[" + i + "]", "Path is required.");

if(!FileSystemHelper.IsPathValid(application.DiskPath))
if (!FileSystemHelper.IsPathValid(application.Path))
AddPropertyError("path[" + i + "]", "Path cannot contain the following characters: ?, ;, :, @, &, =, +, $, ,, |, \", <, >, *.");

var existingApplicationByPath = site.Applications.SingleOrDefault(x => x != site.Applications[i] && x.Path == site.Applications[i].Path);
if (site.SitePath != null && existingApplicationByPath != null)
AddPropertyError("path[" + i + "]", "There's already an application with this path.");

if (!FileSystemHelper.IsPathValid(application.DiskPath))
AddPropertyError("diskpath[" + i + "]", "Path cannot contain the following characters: ?, ;, :, @, &, =, +, $, ,, |, \", <, >, *.");
}
}
}
Expand Down

0 comments on commit 6856c47

Please sign in to comment.