mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-24 05:23:33 +08:00

Minimum profile of services needed to function are registered Certain services are provided by hardcoded replacements implemented only for this context --HG-- branch : dev
46 lines
1.6 KiB
C#
46 lines
1.6 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web.Mvc;
|
|
using System.Web.Routing;
|
|
using Autofac;
|
|
using NUnit.Framework;
|
|
using Orchard.Environment;
|
|
using Orchard.Environment.ShellBuilders;
|
|
using Orchard.Mvc.Filters;
|
|
using Orchard.Mvc.ViewEngines;
|
|
|
|
namespace Orchard.Tests.Environment.ShellBuilders {
|
|
[TestFixture]
|
|
public class SetupShellContainerFactoryTests {
|
|
private IContainer _hostContainer;
|
|
|
|
[SetUp]
|
|
public void Init() {
|
|
_hostContainer = OrchardStarter.CreateHostContainer(builder => {
|
|
builder.Register(new ViewEngineCollection());
|
|
builder.Register(new RouteCollection());
|
|
builder.Register(new ModelBinderDictionary());
|
|
});
|
|
}
|
|
|
|
[Test]
|
|
public void FactoryShouldCreateContainerThatProvidesShell() {
|
|
|
|
var factory = new SetupShellContainerFactory(_hostContainer);
|
|
var shellContainer = factory.CreateContainer(null);
|
|
Assert.That(shellContainer, Is.Not.Null);
|
|
var shell = shellContainer.Resolve<IOrchardShell>();
|
|
Assert.That(shell, Is.Not.Null);
|
|
}
|
|
|
|
[Test]
|
|
public void ShellContainerShouldProvideLayoutViewEngine() {
|
|
var factory = new SetupShellContainerFactory(_hostContainer);
|
|
var shellContainer = factory.CreateContainer(null);
|
|
var viewEngineFilter = shellContainer.Resolve<IEnumerable<IFilterProvider>>()
|
|
.Single(f=>f is ViewEngineFilter);
|
|
Assert.That(viewEngineFilter, Is.Not.Null);
|
|
}
|
|
}
|
|
}
|