* Update gitignore * Move csproj * Update project references * Update solutions * Update build scripts * Tests used to share editorconfig with projects in src * Fix broken tests. * Stop copying around .editorconfig merged root one with linting * csharp_style_expression_bodied -> suggestion * Move StyleCop rulesets to matching directories and update shared build properties * Remove legacy build files, update NuGet.cofig and solution files * Restore myget source * Clean up .gitignore * Update .gitignore * Move new test classes to tests after merge * Gitignore + nuget config * Move new test Co-authored-by: Ronald Barendse <ronald@barend.se>
33 lines
1.3 KiB
C#
33 lines
1.3 KiB
C#
using System.Threading.Tasks;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Logging;
|
|
using NUnit.Framework;
|
|
using Umbraco.Cms.Core.Configuration.Models;
|
|
using Umbraco.Cms.Core.Routing;
|
|
using Umbraco.Cms.Core.Web;
|
|
using Umbraco.Tests.TestHelpers;
|
|
|
|
namespace Umbraco.Tests.Routing
|
|
{
|
|
[TestFixture]
|
|
public class ContentFinderByIdTests : BaseWebTest
|
|
{
|
|
[TestCase("/1046", 1046)]
|
|
[TestCase("/1046.aspx", 1046)]
|
|
public async Task Lookup_By_Id(string urlAsString, int nodeMatch)
|
|
{
|
|
var umbracoContext = GetUmbracoContext(urlAsString);
|
|
var publishedRouter = CreatePublishedRouter(GetUmbracoContextAccessor(umbracoContext));
|
|
var frequest = await publishedRouter.CreateRequestAsync(umbracoContext.CleanedUmbracoUrl);
|
|
var webRoutingSettings = new WebRoutingSettings();
|
|
var lookup = new ContentFinderByIdPath(Microsoft.Extensions.Options.Options.Create(webRoutingSettings), LoggerFactory.CreateLogger<ContentFinderByIdPath>(), Factory.GetRequiredService<IRequestAccessor>(), GetUmbracoContextAccessor(umbracoContext));
|
|
|
|
|
|
var result = lookup.TryFindContent(frequest);
|
|
|
|
Assert.IsTrue(result);
|
|
Assert.AreEqual(frequest.PublishedContent.Id, nodeMatch);
|
|
}
|
|
}
|
|
}
|