mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-12-02 19:44:02 +08:00
Fixing UrlRuleProviderTest
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using Autofac;
|
||||
using NUnit.Framework;
|
||||
using Orchard.Environment.Configuration;
|
||||
using Orchard.Mvc;
|
||||
using Orchard.Tests.Stubs;
|
||||
using Orchard.Widgets.RuleEngine;
|
||||
@@ -11,11 +12,14 @@ namespace Orchard.Tests.Modules.Widgets.RuleEngine {
|
||||
private IContainer _container;
|
||||
private IRuleProvider _urlRuleProvider;
|
||||
private StubHttpContextAccessor _stubContextAccessor;
|
||||
private ShellSettings _shellSettings;
|
||||
|
||||
[SetUp]
|
||||
public void Init() {
|
||||
var builder = new ContainerBuilder();
|
||||
_shellSettings = new ShellSettings {RequestUrlPrefix = string.Empty};
|
||||
builder.RegisterType<UrlRuleProvider>().As<IRuleProvider>();
|
||||
builder.RegisterInstance(_shellSettings);
|
||||
_stubContextAccessor = new StubHttpContextAccessor();
|
||||
builder.RegisterInstance(_stubContextAccessor).As<IHttpContextAccessor>();
|
||||
_container = builder.Build();
|
||||
@@ -69,5 +73,14 @@ namespace Orchard.Tests.Modules.Widgets.RuleEngine {
|
||||
_urlRuleProvider.Process(context);
|
||||
Assert.That(context.Result, Is.True);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void UrlForHomePageMatchesHomePagePathWithUrlPrefix() {
|
||||
_stubContextAccessor.StubContext = new StubHttpContext("~/site1");
|
||||
_shellSettings.RequestUrlPrefix = "site1";
|
||||
var context = new RuleContext { FunctionName = "url", Arguments = new[] { "~/" } };
|
||||
_urlRuleProvider.Process(context);
|
||||
Assert.That(context.Result, Is.True);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user