Started writing NiceUrlProvider unit tests as there are a bunch of issues with it. Have fixed one of them.
Updated unit test hierarchy of classes so that if one doesn't require a db it can opt out and thus it runs much much faster.
This commit is contained in:
@@ -498,9 +498,14 @@ namespace Umbraco.Core.Configuration
|
||||
{
|
||||
get
|
||||
{
|
||||
if (HttpContext != null)
|
||||
return bool.Parse(ConfigurationManager.AppSettings["umbracoHideTopLevelNodeFromPath"]);
|
||||
return false;
|
||||
try
|
||||
{
|
||||
return bool.Parse(ConfigurationManager.AppSettings["umbracoHideTopLevelNodeFromPath"]);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace Umbraco.Tests.DynamicDocument
|
||||
protected override dynamic GetDynamicNode(int id)
|
||||
{
|
||||
var template = Template.MakeNew("test", new User(0));
|
||||
var ctx = GetUmbracoContext("/test", template);
|
||||
var ctx = GetUmbracoContext("/test", template.Id);
|
||||
var contentStore = new XmlPublishedContentStore();
|
||||
var doc = contentStore.GetDocumentById(ctx, id);
|
||||
Assert.IsNotNull(doc);
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace Umbraco.Tests.DynamicDocument
|
||||
protected override dynamic GetDynamicNode(int id)
|
||||
{
|
||||
var template = Template.MakeNew("test", new User(0));
|
||||
var ctx = GetUmbracoContext("/test", template);
|
||||
var ctx = GetUmbracoContext("/test", template.Id);
|
||||
var contentStore = new XmlPublishedContentStore();
|
||||
var node = new DynamicNode(
|
||||
new DynamicBackingItem(
|
||||
|
||||
@@ -23,11 +23,21 @@ namespace Umbraco.Tests.Routing
|
||||
base.TearDown();
|
||||
|
||||
ConfigurationManager.AppSettings.Set("umbracoHideTopLevelNodeFromPath", "");
|
||||
}
|
||||
}
|
||||
|
||||
protected RoutingContext GetRoutingContext(string url, Template template, RouteData routeData = null)
|
||||
/// <summary>
|
||||
/// Return a new RoutingContext
|
||||
/// </summary>
|
||||
/// <param name="url"></param>
|
||||
/// <param name="templateId">
|
||||
/// The template Id to insert into the Xml cache file for each node, this is helpful for unit testing with templates but you
|
||||
/// should normally create the template in the database with this id
|
||||
///</param>
|
||||
/// <param name="routeData"></param>
|
||||
/// <returns></returns>
|
||||
protected RoutingContext GetRoutingContext(string url, int templateId, RouteData routeData = null)
|
||||
{
|
||||
var umbracoContext = GetUmbracoContext(url, template, routeData);
|
||||
var umbracoContext = GetUmbracoContext(url, templateId, routeData);
|
||||
var contentStore = new XmlPublishedContentStore();
|
||||
var niceUrls = new NiceUrlProvider(contentStore, umbracoContext);
|
||||
var routingRequest = new RoutingContext(
|
||||
@@ -39,6 +49,29 @@ namespace Umbraco.Tests.Routing
|
||||
return routingRequest;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return a new RoutingContext
|
||||
/// </summary>
|
||||
/// <param name="url"></param>
|
||||
/// <param name="template"></param>
|
||||
/// <param name="routeData"></param>
|
||||
/// <returns></returns>
|
||||
protected RoutingContext GetRoutingContext(string url, Template template, RouteData routeData = null)
|
||||
{
|
||||
return GetRoutingContext(url, template.Id, routeData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return a new RoutingContext that doesn't require testing based on template
|
||||
/// </summary>
|
||||
/// <param name="url"></param>
|
||||
/// <param name="routeData"></param>
|
||||
/// <returns></returns>
|
||||
protected RoutingContext GetRoutingContext(string url, RouteData routeData = null)
|
||||
{
|
||||
return GetRoutingContext(url, 1234, routeData);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,15 @@ namespace Umbraco.Tests.Routing
|
||||
[TestFixture]
|
||||
public class LookupByAliasTests : BaseRoutingTest
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// We don't need a db for this test, will run faster without one
|
||||
/// </summary>
|
||||
protected override bool RequiresDbSetup
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
[TestCase("/this/is/my/alias", 1046)]
|
||||
[TestCase("/anotheralias", 1046)]
|
||||
[TestCase("/page2/alias", 1173)]
|
||||
@@ -16,8 +25,7 @@ namespace Umbraco.Tests.Routing
|
||||
[TestCase("/ONLY/one/Alias", 1174)]
|
||||
public void Lookup_By_Url_Alias(string urlAsString, int nodeMatch)
|
||||
{
|
||||
var template = Template.MakeNew("test", new User(0));
|
||||
var routingContext = GetRoutingContext(urlAsString, template);
|
||||
var routingContext = GetRoutingContext(urlAsString);
|
||||
var url = routingContext.UmbracoContext.UmbracoUrl; //very important to use the cleaned up umbraco url
|
||||
var docRequest = new DocumentRequest(url, routingContext);
|
||||
var lookup = new LookupByAlias();
|
||||
|
||||
@@ -8,12 +8,19 @@ namespace Umbraco.Tests.Routing
|
||||
[TestFixture]
|
||||
public class LookupByIdTests : BaseRoutingTest
|
||||
{
|
||||
/// <summary>
|
||||
/// We don't need a db for this test, will run faster without one
|
||||
/// </summary>
|
||||
protected override bool RequiresDbSetup
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
[TestCase("/1046", 1046)]
|
||||
[TestCase("/1046.aspx", 1046)]
|
||||
public void Lookup_By_Id(string urlAsString, int nodeMatch)
|
||||
{
|
||||
var template = Template.MakeNew("test", new User(0));
|
||||
var routingContext = GetRoutingContext(urlAsString, template);
|
||||
var routingContext = GetRoutingContext(urlAsString);
|
||||
var url = routingContext.UmbracoContext.UmbracoUrl; //very important to use the cleaned up umbraco url
|
||||
var docRequest = new DocumentRequest(url, routingContext);
|
||||
var lookup = new LookupByIdPath();
|
||||
|
||||
@@ -10,6 +10,14 @@ namespace Umbraco.Tests.Routing
|
||||
public class LookupByNiceUrlTests : BaseRoutingTest
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// We don't need a db for this test, will run faster without one
|
||||
/// </summary>
|
||||
protected override bool RequiresDbSetup
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
[TestCase("/")]
|
||||
[TestCase("/default.aspx")] //this one is actually rather important since this is the path that comes through when we are running in pre-IIS 7 for the root document '/' !
|
||||
[TestCase("/Sub1")]
|
||||
@@ -17,8 +25,7 @@ namespace Umbraco.Tests.Routing
|
||||
[TestCase("/sub1.aspx")]
|
||||
public void Match_Document_By_Url_Hide_Top_Level(string urlAsString)
|
||||
{
|
||||
var template = Template.MakeNew("test", new User(0));
|
||||
var routingContext = GetRoutingContext(urlAsString, template);
|
||||
var routingContext = GetRoutingContext(urlAsString);
|
||||
var url = routingContext.UmbracoContext.UmbracoUrl; //very important to use the cleaned up umbraco url
|
||||
var docRequest = new DocumentRequest(url, routingContext);
|
||||
var lookup = new LookupByNiceUrl();
|
||||
@@ -37,8 +44,7 @@ namespace Umbraco.Tests.Routing
|
||||
[TestCase("/home/Sub1.aspx")]
|
||||
public void Match_Document_By_Url(string urlAsString)
|
||||
{
|
||||
var template = Template.MakeNew("test", new User(0));
|
||||
var routingContext = GetRoutingContext(urlAsString, template);
|
||||
var routingContext = GetRoutingContext(urlAsString);
|
||||
var url = routingContext.UmbracoContext.UmbracoUrl; //very important to use the cleaned up umbraco url
|
||||
var docRequest = new DocumentRequest(url, routingContext);
|
||||
var lookup = new LookupByNiceUrl();
|
||||
|
||||
@@ -9,18 +9,22 @@ namespace Umbraco.Tests.Routing
|
||||
[TestFixture]
|
||||
public class LookupByPageIdQueryTests : BaseRoutingTest
|
||||
{
|
||||
/// <summary>
|
||||
/// We don't need a db for this test, will run faster without one
|
||||
/// </summary>
|
||||
protected override bool RequiresDbSetup
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
[TestCase("/?umbPageId=1046", 1046)]
|
||||
[TestCase("/?UMBPAGEID=1046", 1046)]
|
||||
[TestCase("/default.aspx?umbPageId=1046", 1046)] //TODO: Should this match??
|
||||
[TestCase("/some/other/page?umbPageId=1046", 1046)] //TODO: Should this match??
|
||||
[TestCase("/some/other/page.aspx?umbPageId=1046", 1046)] //TODO: Should this match??
|
||||
public void Lookup_By_Page_Id(string urlAsString, int nodeMatch)
|
||||
{
|
||||
|
||||
|
||||
|
||||
var template = Template.MakeNew("test", new User(0));
|
||||
var routingContext = GetRoutingContext(urlAsString, template);
|
||||
{
|
||||
var routingContext = GetRoutingContext(urlAsString);
|
||||
var url = routingContext.UmbracoContext.UmbracoUrl; //very important to use the cleaned up umbraco url
|
||||
var docRequest = new DocumentRequest(url, routingContext);
|
||||
var lookup = new LookupByPageIdQuery();
|
||||
|
||||
85
src/Umbraco.Tests/Routing/NiceUrlProviderTests.cs
Normal file
85
src/Umbraco.Tests/Routing/NiceUrlProviderTests.cs
Normal file
@@ -0,0 +1,85 @@
|
||||
using System.Configuration;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Umbraco.Tests.Routing
|
||||
{
|
||||
[TestFixture]
|
||||
public class NiceUrlProviderTests : BaseRoutingTest
|
||||
{
|
||||
|
||||
[TestCase(1046, "/home.aspx")]
|
||||
[TestCase(1173, "/home/sub1.aspx")]
|
||||
[TestCase(1174, "/home/sub1/sub2.aspx")]
|
||||
[TestCase(1176, "/home/sub1/sub-3.aspx")]
|
||||
[TestCase(1177, "/home/sub1/custom-sub-1.aspx")]
|
||||
[TestCase(1178, "/home/sub1/custom-sub-2.aspx")]
|
||||
[TestCase(1175, "/home/sub-2.aspx")]
|
||||
[TestCase(1172, "/test-page.aspx")]
|
||||
public void Get_Nice_Url_Not_Hiding_Top_Level_No_Directory_Urls(int nodeId, string niceUrlMatch)
|
||||
{
|
||||
var routingContext = GetRoutingContext("/test", 1111);
|
||||
|
||||
var result = routingContext.NiceUrlProvider.GetNiceUrl(nodeId);
|
||||
|
||||
Assert.AreEqual(niceUrlMatch, result);
|
||||
}
|
||||
|
||||
[TestCase(1046, "/home")]
|
||||
[TestCase(1173, "/home/sub1")]
|
||||
[TestCase(1174, "/home/sub1/sub2")]
|
||||
[TestCase(1176, "/home/sub1/sub-3")]
|
||||
[TestCase(1177, "/home/sub1/custom-sub-1")]
|
||||
[TestCase(1178, "/home/sub1/custom-sub-2")]
|
||||
[TestCase(1175, "/home/sub-2")]
|
||||
[TestCase(1172, "/test-page")]
|
||||
public void Get_Nice_Url_Not_Hiding_Top_Level_With_Directory_Urls(int nodeId, string niceUrlMatch)
|
||||
{
|
||||
var routingContext = GetRoutingContext("/test", 1111);
|
||||
|
||||
ConfigurationManager.AppSettings.Set("umbracoUseDirectoryUrls", "true");
|
||||
|
||||
var result = routingContext.NiceUrlProvider.GetNiceUrl(nodeId);
|
||||
|
||||
Assert.AreEqual(niceUrlMatch, result);
|
||||
}
|
||||
|
||||
[TestCase(1046, "/")]
|
||||
[TestCase(1173, "/sub1.aspx")]
|
||||
[TestCase(1174, "/sub1/sub2.aspx")]
|
||||
[TestCase(1176, "/sub1/sub-3.aspx")]
|
||||
[TestCase(1177, "/sub1/custom-sub-1.aspx")]
|
||||
[TestCase(1178, "/sub1/custom-sub-2.aspx")]
|
||||
[TestCase(1175, "/sub-2.aspx")]
|
||||
[TestCase(1172, "/test-page.aspx")]
|
||||
public void Get_Nice_Url_Hiding_Top_Level_No_Directory_Urls(int nodeId, string niceUrlMatch)
|
||||
{
|
||||
var routingContext = GetRoutingContext("/test", 1111);
|
||||
|
||||
ConfigurationManager.AppSettings.Set("umbracoHideTopLevelNodeFromPath", "true");
|
||||
|
||||
var result = routingContext.NiceUrlProvider.GetNiceUrl(nodeId);
|
||||
|
||||
Assert.AreEqual(niceUrlMatch, result);
|
||||
}
|
||||
|
||||
[TestCase(1046, "/")]
|
||||
[TestCase(1173, "/sub1")]
|
||||
[TestCase(1174, "/sub1/sub2")]
|
||||
[TestCase(1176, "/sub1/sub-3")]
|
||||
[TestCase(1177, "/sub1/custom-sub-1")]
|
||||
[TestCase(1178, "/sub1/custom-sub-2")]
|
||||
[TestCase(1175, "/sub-2")]
|
||||
[TestCase(1172, "/test-page")]
|
||||
public void Get_Nice_Url_Hiding_Top_Level_With_Directory_Urls(int nodeId, string niceUrlMatch)
|
||||
{
|
||||
var routingContext = GetRoutingContext("/test", 1111);
|
||||
|
||||
ConfigurationManager.AppSettings.Set("umbracoHideTopLevelNodeFromPath", "true");
|
||||
ConfigurationManager.AppSettings.Set("umbracoUseDirectoryUrls", "true");
|
||||
|
||||
var result = routingContext.NiceUrlProvider.GetNiceUrl(nodeId);
|
||||
|
||||
Assert.AreEqual(niceUrlMatch, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,8 @@ namespace Umbraco.Tests.TestHelpers
|
||||
public virtual void Initialize()
|
||||
{
|
||||
TestHelper.SetupLog4NetForTests();
|
||||
TestHelper.InitializeDatabase();
|
||||
if (RequiresDbSetup)
|
||||
TestHelper.InitializeDatabase();
|
||||
Resolution.Freeze();
|
||||
ApplicationContext = new ApplicationContext() { IsReady = true };
|
||||
}
|
||||
@@ -32,10 +33,19 @@ namespace Umbraco.Tests.TestHelpers
|
||||
//reset the context on global settings
|
||||
Umbraco.Core.Configuration.GlobalSettings.HttpContext = null;
|
||||
Resolution.IsFrozen = false;
|
||||
TestHelper.ClearDatabase();
|
||||
if (RequiresDbSetup)
|
||||
TestHelper.ClearDatabase();
|
||||
Cache.ClearAllCache();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// By default this unit test will create and initialize an umbraco database
|
||||
/// </summary>
|
||||
protected virtual bool RequiresDbSetup
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
protected FakeHttpContextFactory GetHttpContextFactory(string url, RouteData routeData = null)
|
||||
{
|
||||
var factory = routeData != null
|
||||
@@ -51,17 +61,17 @@ namespace Umbraco.Tests.TestHelpers
|
||||
|
||||
protected ApplicationContext ApplicationContext { get; private set; }
|
||||
|
||||
protected UmbracoContext GetUmbracoContext(string url, Template template, RouteData routeData = null)
|
||||
protected UmbracoContext GetUmbracoContext(string url, int templateId, RouteData routeData = null)
|
||||
{
|
||||
var ctx = new UmbracoContext(
|
||||
GetHttpContextFactory(url, routeData).HttpContext,
|
||||
ApplicationContext,
|
||||
new FakeRoutesCache());
|
||||
SetupUmbracoContextForTest(ctx, template);
|
||||
SetupUmbracoContextForTest(ctx, templateId);
|
||||
return ctx;
|
||||
}
|
||||
|
||||
protected virtual string GetXmlContent(Template template)
|
||||
protected virtual string GetXmlContent(int templateId)
|
||||
{
|
||||
return @"<?xml version=""1.0"" encoding=""utf-8""?>
|
||||
<!DOCTYPE root[
|
||||
@@ -71,28 +81,28 @@ namespace Umbraco.Tests.TestHelpers
|
||||
<!ATTLIST CustomDocument id ID #REQUIRED>
|
||||
]>
|
||||
<root id=""-1"">
|
||||
<Home id=""1046"" parentID=""-1"" level=""1"" writerID=""0"" creatorID=""0"" nodeType=""1044"" template=""" + template.Id + @""" sortOrder=""2"" createDate=""2012-06-12T14:13:17"" updateDate=""2012-07-20T18:50:43"" nodeName=""Home"" urlName=""home"" writerName=""admin"" creatorName=""admin"" path=""-1,1046"" isDoc="""">
|
||||
<Home id=""1046"" parentID=""-1"" level=""1"" writerID=""0"" creatorID=""0"" nodeType=""1044"" template=""" + templateId + @""" sortOrder=""2"" createDate=""2012-06-12T14:13:17"" updateDate=""2012-07-20T18:50:43"" nodeName=""Home"" urlName=""home"" writerName=""admin"" creatorName=""admin"" path=""-1,1046"" isDoc="""">
|
||||
<content><![CDATA[]]></content>
|
||||
<umbracoUrlAlias><![CDATA[this/is/my/alias, anotheralias]]></umbracoUrlAlias>
|
||||
<umbracoNaviHide>1</umbracoNaviHide>
|
||||
<Home id=""1173"" parentID=""1046"" level=""2"" writerID=""0"" creatorID=""0"" nodeType=""1044"" template=""" + template.Id + @""" sortOrder=""1"" createDate=""2012-07-20T18:06:45"" updateDate=""2012-07-20T19:07:31"" nodeName=""Sub1"" urlName=""sub1"" writerName=""admin"" creatorName=""admin"" path=""-1,1046,1173"" isDoc="""">
|
||||
<Home id=""1173"" parentID=""1046"" level=""2"" writerID=""0"" creatorID=""0"" nodeType=""1044"" template=""" + templateId + @""" sortOrder=""1"" createDate=""2012-07-20T18:06:45"" updateDate=""2012-07-20T19:07:31"" nodeName=""Sub1"" urlName=""sub1"" writerName=""admin"" creatorName=""admin"" path=""-1,1046,1173"" isDoc="""">
|
||||
<content><![CDATA[<div>This is some content</div>]]></content>
|
||||
<umbracoUrlAlias><![CDATA[page2/alias, 2ndpagealias]]></umbracoUrlAlias>
|
||||
<Home id=""1174"" parentID=""1173"" level=""3"" writerID=""0"" creatorID=""0"" nodeType=""1044"" template=""" + template.Id + @""" sortOrder=""1"" createDate=""2012-07-20T18:07:54"" updateDate=""2012-07-20T19:10:27"" nodeName=""Sub2"" urlName=""sub2"" writerName=""admin"" creatorName=""admin"" path=""-1,1046,1173,1174"" isDoc="""">
|
||||
<Home id=""1174"" parentID=""1173"" level=""3"" writerID=""0"" creatorID=""0"" nodeType=""1044"" template=""" + templateId + @""" sortOrder=""1"" createDate=""2012-07-20T18:07:54"" updateDate=""2012-07-20T19:10:27"" nodeName=""Sub2"" urlName=""sub2"" writerName=""admin"" creatorName=""admin"" path=""-1,1046,1173,1174"" isDoc="""">
|
||||
<content><![CDATA[]]></content>
|
||||
<umbracoUrlAlias><![CDATA[only/one/alias]]></umbracoUrlAlias>
|
||||
<creatorName><![CDATA[Custom data with same property name as the member name]]></creatorName>
|
||||
</Home>
|
||||
<Home id=""1176"" parentID=""1173"" level=""3"" writerID=""0"" creatorID=""0"" nodeType=""1044"" template=""" + template.Id + @""" sortOrder=""2"" createDate=""2012-07-20T18:08:08"" updateDate=""2012-07-20T19:10:52"" nodeName=""Sub 3"" urlName=""sub-3"" writerName=""admin"" creatorName=""admin"" path=""-1,1046,1173,1176"" isDoc="""">
|
||||
<Home id=""1176"" parentID=""1173"" level=""3"" writerID=""0"" creatorID=""0"" nodeType=""1044"" template=""" + templateId + @""" sortOrder=""2"" createDate=""2012-07-20T18:08:08"" updateDate=""2012-07-20T19:10:52"" nodeName=""Sub 3"" urlName=""sub-3"" writerName=""admin"" creatorName=""admin"" path=""-1,1046,1173,1176"" isDoc="""">
|
||||
<content><![CDATA[]]></content>
|
||||
</Home>
|
||||
<CustomDocument id=""1177"" parentID=""1173"" level=""3"" writerID=""0"" creatorID=""0"" nodeType=""1234"" template=""" + template.Id + @""" sortOrder=""3"" createDate=""2012-07-16T15:26:59"" updateDate=""2012-07-18T14:23:35"" nodeName=""custom sub 1"" urlName=""custom-sub-1"" writerName=""admin"" creatorName=""admin"" path=""-1,1046,1173,1177"" isDoc="""" />
|
||||
<CustomDocument id=""1178"" parentID=""1173"" level=""3"" writerID=""0"" creatorID=""0"" nodeType=""1234"" template=""" + template.Id + @""" sortOrder=""3"" createDate=""2012-07-16T15:26:59"" updateDate=""2012-07-16T14:23:35"" nodeName=""custom sub 2"" urlName=""custom-sub-2"" writerName=""admin"" creatorName=""admin"" path=""-1,1046,1173,1178"" isDoc="""" />
|
||||
<CustomDocument id=""1177"" parentID=""1173"" level=""3"" writerID=""0"" creatorID=""0"" nodeType=""1234"" template=""" + templateId + @""" sortOrder=""3"" createDate=""2012-07-16T15:26:59"" updateDate=""2012-07-18T14:23:35"" nodeName=""custom sub 1"" urlName=""custom-sub-1"" writerName=""admin"" creatorName=""admin"" path=""-1,1046,1173,1177"" isDoc="""" />
|
||||
<CustomDocument id=""1178"" parentID=""1173"" level=""3"" writerID=""0"" creatorID=""0"" nodeType=""1234"" template=""" + templateId + @""" sortOrder=""3"" createDate=""2012-07-16T15:26:59"" updateDate=""2012-07-16T14:23:35"" nodeName=""custom sub 2"" urlName=""custom-sub-2"" writerName=""admin"" creatorName=""admin"" path=""-1,1046,1173,1178"" isDoc="""" />
|
||||
</Home>
|
||||
<Home id=""1175"" parentID=""1046"" level=""2"" writerID=""0"" creatorID=""0"" nodeType=""1044"" template=""" + template.Id + @""" sortOrder=""2"" createDate=""2012-07-20T18:08:01"" updateDate=""2012-07-20T18:49:32"" nodeName=""Sub 2"" urlName=""sub-2"" writerName=""admin"" creatorName=""admin"" path=""-1,1046,1175"" isDoc=""""><content><![CDATA[]]></content>
|
||||
<Home id=""1175"" parentID=""1046"" level=""2"" writerID=""0"" creatorID=""0"" nodeType=""1044"" template=""" + templateId + @""" sortOrder=""2"" createDate=""2012-07-20T18:08:01"" updateDate=""2012-07-20T18:49:32"" nodeName=""Sub 2"" urlName=""sub-2"" writerName=""admin"" creatorName=""admin"" path=""-1,1046,1175"" isDoc=""""><content><![CDATA[]]></content>
|
||||
</Home>
|
||||
</Home>
|
||||
<CustomDocument id=""1172"" parentID=""-1"" level=""1"" writerID=""0"" creatorID=""0"" nodeType=""1234"" template=""" + template.Id + @""" sortOrder=""3"" createDate=""2012-07-16T15:26:59"" updateDate=""2012-07-18T14:23:35"" nodeName=""Test"" urlName=""test-page"" writerName=""admin"" creatorName=""admin"" path=""-1,1172"" isDoc="""" />
|
||||
<CustomDocument id=""1172"" parentID=""-1"" level=""1"" writerID=""0"" creatorID=""0"" nodeType=""1234"" template=""" + templateId + @""" sortOrder=""3"" createDate=""2012-07-16T15:26:59"" updateDate=""2012-07-18T14:23:35"" nodeName=""Test"" urlName=""test-page"" writerName=""admin"" creatorName=""admin"" path=""-1,1172"" isDoc="""" />
|
||||
</root>";
|
||||
}
|
||||
|
||||
@@ -100,8 +110,8 @@ namespace Umbraco.Tests.TestHelpers
|
||||
/// Initlializes the UmbracoContext with specific XML
|
||||
/// </summary>
|
||||
/// <param name="umbracoContext"></param>
|
||||
/// <param name="template"></param>
|
||||
protected void SetupUmbracoContextForTest(UmbracoContext umbracoContext, Template template)
|
||||
/// <param name="templateId"></param>
|
||||
protected void SetupUmbracoContextForTest(UmbracoContext umbracoContext, int templateId)
|
||||
{
|
||||
umbracoContext.GetXmlDelegate = () =>
|
||||
{
|
||||
@@ -109,7 +119,7 @@ namespace Umbraco.Tests.TestHelpers
|
||||
|
||||
//create a custom xml structure to return
|
||||
|
||||
xDoc.LoadXml(GetXmlContent(template));
|
||||
xDoc.LoadXml(GetXmlContent(templateId));
|
||||
//return the custom x doc
|
||||
return xDoc;
|
||||
};
|
||||
|
||||
@@ -70,6 +70,7 @@
|
||||
<Compile Include="Routing\LookupByNiceUrlAndTemplateTests.cs" />
|
||||
<Compile Include="Routing\LookupByNiceUrlTests.cs" />
|
||||
<Compile Include="Routing\LookupByPageIdQueryTests.cs" />
|
||||
<Compile Include="Routing\NiceUrlProviderTests.cs" />
|
||||
<Compile Include="Routing\RenderRouteHandlerTests.cs" />
|
||||
<Compile Include="Routing\RouteTestExtensions.cs" />
|
||||
<Compile Include="Stubs\TestControllerFactory.cs" />
|
||||
|
||||
@@ -97,7 +97,14 @@ namespace Umbraco.Web.Routing
|
||||
{
|
||||
pathParts.Add(_publishedContentStore.GetDocumentProperty(_umbracoContext, node, UrlNameProperty));
|
||||
node = node.Parent; // set to parent node
|
||||
id = int.Parse(_publishedContentStore.GetDocumentProperty(_umbracoContext, node, "@id")); // will be -1 or 1234
|
||||
if (node == null)
|
||||
{
|
||||
id = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
id = int.Parse(_publishedContentStore.GetDocumentProperty(_umbracoContext, node, "@id")); // will be -1 or 1234
|
||||
}
|
||||
domainUri = id > 0 ? DomainUriAtNode(id, current) : null;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,17 +25,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Docs", "Docs", "{FD962632-1
|
||||
..\docs\ReleaseNotes.txt = ..\docs\ReleaseNotes.txt
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Nant", "Nant", "{17E547B1-D89B-4C76-AB9C-F05888397FA4}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
..\build\Nant\aspnet35.build = ..\build\Nant\aspnet35.build
|
||||
..\build\Nant\aspnet35.config = ..\build\Nant\aspnet35.config
|
||||
..\build\Nant\build.xml = ..\build\Nant\build.xml
|
||||
..\build\Nant\default.build = ..\build\Nant\default.build
|
||||
..\build\Nant\nuget.build = ..\build\Nant\nuget.build
|
||||
..\build\Nant\umbraco weekly.build = ..\build\Nant\umbraco weekly.build
|
||||
..\build\Nant\umbraco.build = ..\build\Nant\umbraco.build
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Umbraco.Web", "Umbraco.Web\Umbraco.Web.csproj", "{651E1350-91B6-44B7-BD60-7207006D7003}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "umbraco.businesslogic", "umbraco.businesslogic\umbraco.businesslogic.csproj", "{E469A9CE-1BEC-423F-AC44-713CD72457EA}"
|
||||
@@ -154,7 +143,6 @@ Global
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{17E547B1-D89B-4C76-AB9C-F05888397FA4} = {2849E9D4-3B4E-40A3-A309-F3CB4F0E125F}
|
||||
{6277C9FB-3A9A-4537-AA86-82DA9B2527FD} = {B5BD12C1-A454-435E-8A46-FF4A364C0382}
|
||||
{5D3B8245-ADA6-453F-A008-50ED04BFE770} = {B5BD12C1-A454-435E-8A46-FF4A364C0382}
|
||||
EndGlobalSection
|
||||
|
||||
Reference in New Issue
Block a user