Adding some spec tests for the routeable part's slug prefix display in the editor (for blogs)

--HG--
branch : dev
This commit is contained in:
Nathan Heskew
2010-11-29 16:01:46 -08:00
parent ff8eceefc9
commit de949ccdfc
6 changed files with 240 additions and 134 deletions

View File

@@ -6,8 +6,6 @@ using System.Linq;
using System.Text;
using System.Web;
using System.Web.Hosting;
using HtmlAgilityPack;
using Orchard.Commands;
using Orchard.Specs.Util;
namespace Orchard.Specs.Hosting {
@@ -16,12 +14,13 @@ namespace Orchard.Specs.Hosting {
var physicalPath = Bleroy.FluentPath.Path.Get(webHost.PhysicalDirectory);
urlPath = StripVDir(urlPath, webHost.VirtualDirectory);
var details = new RequestDetails {
HostName = webHost.HostName,
UrlPath = urlPath,
Page = physicalPath
.Combine(urlPath.TrimStart('/', '\\'))
.GetRelativePath(physicalPath),
.GetRelativePath(physicalPath)
};
if (!string.IsNullOrEmpty(webHost.Cookies)) {
@@ -52,6 +51,12 @@ namespace Orchard.Specs.Hosting {
return details;
}
private static string StripVDir(string urlPath, string virtualDirectory) {
return urlPath.StartsWith(virtualDirectory, StringComparison.OrdinalIgnoreCase)
? urlPath.Substring(virtualDirectory.Length)
: urlPath;
}
public static RequestDetails SendRequest(this WebHost webHost, string urlPath) {
return webHost.SendRequest(urlPath, null);
}