Files
Orchard/src/Orchard.Tests/Environment/ShellBuilders/SetupShellContainerFactoryTests.cs
Louis DeJardin 79fe90356b Adding a Setup mode shell container factory
Minimum profile of services needed to function are registered
Certain services are provided by hardcoded replacements implemented only for this context

--HG--
branch : dev
2010-02-04 19:47:24 -08:00

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);
}
}
}