From b596b3584e9461be6abd21f600539633488ea5ae Mon Sep 17 00:00:00 2001 From: Shannon Deminick Date: Tue, 14 Aug 2012 23:56:23 +0600 Subject: [PATCH] Added lookup by id tests. --- .../DocumentLookups/LookupByIdTests.cs | 28 +++++++++++++++++++ src/Umbraco.Tests/Umbraco.Tests.csproj | 1 + 2 files changed, 29 insertions(+) create mode 100644 src/Umbraco.Tests/DocumentLookups/LookupByIdTests.cs diff --git a/src/Umbraco.Tests/DocumentLookups/LookupByIdTests.cs b/src/Umbraco.Tests/DocumentLookups/LookupByIdTests.cs new file mode 100644 index 0000000000..47a0332697 --- /dev/null +++ b/src/Umbraco.Tests/DocumentLookups/LookupByIdTests.cs @@ -0,0 +1,28 @@ +using NUnit.Framework; +using Umbraco.Web.Routing; +using umbraco.BusinessLogic; +using umbraco.cms.businesslogic.template; + +namespace Umbraco.Tests.DocumentLookups +{ + [TestFixture] + public class LookupByIdTests : BaseRoutingTest + { + [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 url = routingContext.UmbracoContext.UmbracoUrl; //very important to use the cleaned up umbraco url + var docRequest = new DocumentRequest(url, routingContext); + var lookup = new LookupById(); + Umbraco.Core.Configuration.GlobalSettings.HttpContext = routingContext.UmbracoContext.HttpContext; + + var result = lookup.TrySetDocument(docRequest); + + Assert.IsTrue(result); + Assert.AreEqual(docRequest.NodeId, nodeMatch); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Tests/Umbraco.Tests.csproj b/src/Umbraco.Tests/Umbraco.Tests.csproj index 51599750d7..1ed1e7d4b3 100644 --- a/src/Umbraco.Tests/Umbraco.Tests.csproj +++ b/src/Umbraco.Tests/Umbraco.Tests.csproj @@ -62,6 +62,7 @@ +