--HG--
branch : dev
This commit is contained in:
Renaud Paquay
2010-06-11 21:23:42 -07:00
48 changed files with 348 additions and 292 deletions

View File

@@ -2,8 +2,9 @@
using System.IO;
using NUnit.Framework;
using Orchard.Data.Builders;
using Orchard.Environment.Topology;
using Orchard.Environment.Topology.Models;
using Orchard.Environment.Descriptor;
using Orchard.Environment.Descriptor.Models;
using Orchard.Environment.ShellBuilders.Models;
using Orchard.Tests.Records;
namespace Orchard.Tests.Data.Builders {
@@ -49,7 +50,7 @@ namespace Orchard.Tests.Data.Builders {
[Test]
public void SQLiteSchemaShouldBeGeneratedAndUsable() {
var recordDescriptors = new[] {
new RecordTopology {TableName = "Hello", Type = typeof (FooRecord)}
new RecordBlueprint {TableName = "Hello", Type = typeof (FooRecord)}
};
var manager = (ISessionFactoryBuilder)new SessionFactoryBuilder();
var sessionFactory = manager.BuildSessionFactory(new SessionFactoryParameters {
@@ -78,7 +79,7 @@ namespace Orchard.Tests.Data.Builders {
CreateSqlServerDatabase(databasePath);
var recordDescriptors = new[] {
new RecordTopology {TableName = "Hello", Type = typeof (FooRecord)}
new RecordBlueprint {TableName = "Hello", Type = typeof (FooRecord)}
};
var manager = (ISessionFactoryBuilder)new SessionFactoryBuilder();

View File

@@ -9,7 +9,8 @@ using NHibernate;
using NHibernate.Tool.hbm2ddl;
using Orchard.Data;
using Orchard.Data.Builders;
using Orchard.Environment.Topology.Models;
using Orchard.Environment.Descriptor.Models;
using Orchard.Environment.ShellBuilders.Models;
namespace Orchard.Tests {
public static class DataUtility {
@@ -18,7 +19,7 @@ namespace Orchard.Tests {
//var persistenceModel = AutoMap.Source(new Types(types))
// .Alterations(alt => AddAlterations(alt, types))
// .Conventions.AddFromAssemblyOf<DataModule>();
var persistenceModel = AbstractBuilder.CreatePersistenceModel(types.Select(t => new RecordTopology { TableName = "Test_" + t.Name,Type = t }));
var persistenceModel = AbstractBuilder.CreatePersistenceModel(types.Select(t => new RecordBlueprint { TableName = "Test_" + t.Name,Type = t }));
return Fluently.Configure()
.Database(SQLiteConfiguration.Standard.UsingFile(fileName).ShowSql())

View File

@@ -3,14 +3,11 @@ using System.Runtime.Serialization;
using System.Xml;
using Autofac;
using NUnit.Framework;
using Orchard.Environment;
using Orchard.Environment.Topology;
using Orchard.Environment.Topology.Models;
using Orchard.Environment.Descriptor;
using Orchard.Environment.Descriptor.Models;
using Orchard.FileSystems.AppData;
using Orchard.FileSystems.VirtualPath;
using Orchard.Services;
namespace Orchard.Tests.Environment.Topology {
namespace Orchard.Tests.Environment.Blueprint {
[TestFixture]
public class DefaultShellDescriptorCacheTests {
private IContainer _container;
@@ -22,7 +19,7 @@ namespace Orchard.Tests.Environment.Topology {
_tempFolder = Path.GetTempFileName();
File.Delete(_tempFolder);
Directory.CreateDirectory(_tempFolder);
_appDataFolder = new AppDataFolder(new DefaultVirtualPathMonitor(new Clock()));
_appDataFolder = new AppDataFolder();
_appDataFolder.SetBasePath(_tempFolder);
var builder = new ContainerBuilder();
builder.RegisterInstance(_appDataFolder).As<IAppDataFolder>();

View File

@@ -11,7 +11,8 @@ using Orchard.ContentManagement.Records;
using Orchard.Environment.Configuration;
using Orchard.Environment.Extensions;
using Orchard.Environment.Extensions.Models;
using Orchard.Environment.Topology;
using Orchard.Environment.Descriptor;
using Orchard.Environment.ShellBuilders;
using Orchard.Tests.Environment.Utility;
using Orchard.Tests.Records;
using Orchard.Tests.Utility;
@@ -57,19 +58,19 @@ namespace Orchard.Tests.Environment {
}
[Test]
public void TopologyIsNotNull() {
var descriptor = Build.TopologyDescriptor();
public void BlueprintIsNotNull() {
var descriptor = Build.ShellDescriptor();
var compositionStrategy = _container.Resolve<ICompositionStrategy>();
var topology = compositionStrategy.Compose(BuildDefaultSettings(), descriptor);
var blueprint = compositionStrategy.Compose(BuildDefaultSettings(), descriptor);
Assert.That(topology, Is.Not.Null);
Assert.That(blueprint, Is.Not.Null);
}
[Test]
public void DependenciesFromFeatureArePutIntoTopology() {
var descriptor = Build.TopologyDescriptor().WithFeatures("Foo", "Bar");
public void DependenciesFromFeatureArePutIntoBlueprint() {
var descriptor = Build.ShellDescriptor().WithFeatures("Foo", "Bar");
_extensionDescriptors = new[] {
Build.ExtensionDescriptor("Foo").WithFeatures("Foo"),
@@ -80,16 +81,16 @@ namespace Orchard.Tests.Environment {
_featureTypes["Bar"] = new[] { typeof(BarService1) };
var compositionStrategy = _container.Resolve<ICompositionStrategy>();
var topology = compositionStrategy.Compose(BuildDefaultSettings(), descriptor);
var blueprint = compositionStrategy.Compose(BuildDefaultSettings(), descriptor);
Assert.That(topology, Is.Not.Null);
Assert.That(topology.Dependencies.Count(), Is.EqualTo(2));
Assert.That(blueprint, Is.Not.Null);
Assert.That(blueprint.Dependencies.Count(), Is.EqualTo(2));
var foo = topology.Dependencies.SingleOrDefault(t => t.Type == typeof(FooService1));
var foo = blueprint.Dependencies.SingleOrDefault(t => t.Type == typeof(FooService1));
Assert.That(foo, Is.Not.Null);
Assert.That(foo.Feature.Descriptor.Name, Is.EqualTo("Foo"));
var bar = topology.Dependencies.SingleOrDefault(t => t.Type == typeof(BarService1));
var bar = blueprint.Dependencies.SingleOrDefault(t => t.Type == typeof(BarService1));
Assert.That(bar, Is.Not.Null);
Assert.That(bar.Feature.Descriptor.Name, Is.EqualTo("Bar"));
}
@@ -109,7 +110,7 @@ namespace Orchard.Tests.Environment {
[Test]
public void DependenciesAreGivenParameters() {
var descriptor = Build.TopologyDescriptor()
var descriptor = Build.ShellDescriptor()
.WithFeatures("Foo")
.WithParameter<FooService1>("one", "two")
.WithParameter<FooService1>("three", "four");
@@ -121,9 +122,9 @@ namespace Orchard.Tests.Environment {
_featureTypes["Foo"] = new[] { typeof(FooService1) };
var compositionStrategy = _container.Resolve<ICompositionStrategy>();
var topology = compositionStrategy.Compose(BuildDefaultSettings(), descriptor);
var blueprint = compositionStrategy.Compose(BuildDefaultSettings(), descriptor);
var foo = topology.Dependencies.SingleOrDefault(t => t.Type == typeof(FooService1));
var foo = blueprint.Dependencies.SingleOrDefault(t => t.Type == typeof(FooService1));
Assert.That(foo, Is.Not.Null);
Assert.That(foo.Parameters.Count(), Is.EqualTo(2));
Assert.That(foo.Parameters.Single(x => x.Name == "one").Value, Is.EqualTo("two"));
@@ -131,8 +132,8 @@ namespace Orchard.Tests.Environment {
}
[Test]
public void ModulesArePutIntoTopology() {
var descriptor = Build.TopologyDescriptor().WithFeatures("Foo", "Bar");
public void ModulesArePutIntoBlueprint() {
var descriptor = Build.ShellDescriptor().WithFeatures("Foo", "Bar");
_extensionDescriptors = new[] {
Build.ExtensionDescriptor("Foo").WithFeatures("Foo"),
@@ -143,10 +144,10 @@ namespace Orchard.Tests.Environment {
_featureTypes["Bar"] = new[] { typeof(BetaModule) };
var compositionStrategy = _container.Resolve<ICompositionStrategy>();
var topology = compositionStrategy.Compose(BuildDefaultSettings(), descriptor);
var blueprint = compositionStrategy.Compose(BuildDefaultSettings(), descriptor);
var alpha = topology.Dependencies.Single(x => x.Type == typeof(AlphaModule));
var beta = topology.Dependencies.Single(x => x.Type == typeof(BetaModule));
var alpha = blueprint.Dependencies.Single(x => x.Type == typeof(AlphaModule));
var beta = blueprint.Dependencies.Single(x => x.Type == typeof(BetaModule));
Assert.That(alpha.Feature.Descriptor.Name, Is.EqualTo("Foo"));
Assert.That(beta.Feature.Descriptor.Name, Is.EqualTo("Bar"));
@@ -162,8 +163,8 @@ namespace Orchard.Tests.Environment {
}
[Test]
public void ControllersArePutIntoTopologyWithAreaAndControllerName() {
var descriptor = Build.TopologyDescriptor().WithFeatures("Foo Plus", "Bar Minus");
public void ControllersArePutIntoBlueprintWithAreaAndControllerName() {
var descriptor = Build.ShellDescriptor().WithFeatures("Foo Plus", "Bar Minus");
_extensionDescriptors = new[] {
Build.ExtensionDescriptor("MyCompany.Foo", "Foo").WithFeatures("Foo", "Foo Plus"),
@@ -176,11 +177,11 @@ namespace Orchard.Tests.Environment {
_featureTypes["Bar Minus"] = new[] { typeof(DeltaController), typeof(EpsilonController) };
var compositionStrategy = _container.Resolve<ICompositionStrategy>();
var topology = compositionStrategy.Compose(BuildDefaultSettings(), descriptor);
var blueprint = compositionStrategy.Compose(BuildDefaultSettings(), descriptor);
var gamma = topology.Controllers.Single(x => x.Type == typeof(GammaController));
var delta = topology.Controllers.Single(x => x.Type == typeof(DeltaController));
var epsilon = topology.Controllers.Single(x => x.Type == typeof(EpsilonController));
var gamma = blueprint.Controllers.Single(x => x.Type == typeof(GammaController));
var delta = blueprint.Controllers.Single(x => x.Type == typeof(DeltaController));
var epsilon = blueprint.Controllers.Single(x => x.Type == typeof(EpsilonController));
Assert.That(gamma.Feature.Descriptor.Name, Is.EqualTo("Foo Plus"));
Assert.That(gamma.AreaName, Is.EqualTo("MyCompany.Foo"));
@@ -213,8 +214,8 @@ namespace Orchard.Tests.Environment {
[Test]
public void RecordsArePutIntoTopologyWithTableName() {
var descriptor = Build.TopologyDescriptor().WithFeatures("Foo Plus", "Bar", "Bar Minus");
public void RecordsArePutIntoBlueprintWithTableName() {
var descriptor = Build.ShellDescriptor().WithFeatures("Foo Plus", "Bar", "Bar Minus");
_extensionDescriptors = new[] {
Build.ExtensionDescriptor("MyCompany.Foo", "Foo").WithFeatures("Foo", "Foo Plus"),
@@ -227,10 +228,10 @@ namespace Orchard.Tests.Environment {
_featureTypes["Bar Minus"] = Enumerable.Empty<Type>();
var compositionStrategy = _container.Resolve<ICompositionStrategy>();
var topology = compositionStrategy.Compose(BuildDefaultSettings(), descriptor);
var blueprint = compositionStrategy.Compose(BuildDefaultSettings(), descriptor);
var foo = topology.Records.Single(x => x.Type == typeof(FooRecord));
var bar = topology.Records.Single(x => x.Type == typeof(BarRecord));
var foo = blueprint.Records.Single(x => x.Type == typeof(FooRecord));
var bar = blueprint.Records.Single(x => x.Type == typeof(BarRecord));
Assert.That(foo.Feature.Descriptor.Name, Is.EqualTo("Foo Plus"));
Assert.That(foo.TableName, Is.EqualTo("MyCompany_Foo_FooRecord"));
@@ -241,14 +242,14 @@ namespace Orchard.Tests.Environment {
[Test]
public void CoreRecordsAreAddedAutomatically() {
var descriptor = Build.TopologyDescriptor().WithFeatures("Orchard.Framework");
var descriptor = Build.ShellDescriptor().WithFeatures("Orchard.Framework");
var compositionStrategy = _container.Resolve<ICompositionStrategy>();
var topology = compositionStrategy.Compose(BuildDefaultSettings(), descriptor);
var blueprint = compositionStrategy.Compose(BuildDefaultSettings(), descriptor);
var ct = topology.Records.Single(x => x.Type == typeof(ContentTypeRecord));
var ci = topology.Records.Single(x => x.Type == typeof(ContentItemRecord));
var civ = topology.Records.Single(x => x.Type == typeof(ContentItemVersionRecord));
var ct = blueprint.Records.Single(x => x.Type == typeof(ContentTypeRecord));
var ci = blueprint.Records.Single(x => x.Type == typeof(ContentItemRecord));
var civ = blueprint.Records.Single(x => x.Type == typeof(ContentItemVersionRecord));
Assert.That(ct.Feature.Descriptor.Name, Is.EqualTo("Orchard.Framework"));
Assert.That(ct.TableName, Is.EqualTo("Orchard_Framework_ContentTypeRecord"));
@@ -264,7 +265,7 @@ namespace Orchard.Tests.Environment {
public void DataPrefixChangesTableName() {
var settings = BuildDefaultSettings();
settings.DataTablePrefix = "Yadda";
var descriptor = Build.TopologyDescriptor().WithFeatures("Foo Plus", "Bar", "Bar Minus");
var descriptor = Build.ShellDescriptor().WithFeatures("Foo Plus", "Bar", "Bar Minus");
_extensionDescriptors = new[] {
Build.ExtensionDescriptor("MyCompany.Foo", "Foo").WithFeatures("Foo", "Foo Plus"),
@@ -277,10 +278,10 @@ namespace Orchard.Tests.Environment {
_featureTypes["Bar Minus"] = Enumerable.Empty<Type>();
var compositionStrategy = _container.Resolve<ICompositionStrategy>();
var topology = compositionStrategy.Compose(settings, descriptor);
var blueprint = compositionStrategy.Compose(settings, descriptor);
var foo = topology.Records.Single(x => x.Type == typeof(FooRecord));
var bar = topology.Records.Single(x => x.Type == typeof(BarRecord));
var foo = blueprint.Records.Single(x => x.Type == typeof(FooRecord));
var bar = blueprint.Records.Single(x => x.Type == typeof(BarRecord));
Assert.That(foo.Feature.Descriptor.Name, Is.EqualTo("Foo Plus"));
Assert.That(foo.TableName, Is.EqualTo("Yadda_MyCompany_Foo_FooRecord"));

View File

@@ -16,8 +16,8 @@ using Orchard.Environment.Extensions;
using Orchard.Environment.Extensions.Folders;
using Orchard.Environment.Extensions.Models;
using Orchard.Environment.ShellBuilders;
using Orchard.Environment.Topology;
using Orchard.Environment.Topology.Models;
using Orchard.Environment.Descriptor;
using Orchard.Environment.Descriptor.Models;
using Orchard.FileSystems.AppData;
using Orchard.Mvc;
using Orchard.Mvc.ModelBinders;

View File

@@ -14,7 +14,8 @@ using Orchard.Environment.AutofacUtil.DynamicProxy2;
using Orchard.Environment.Configuration;
using Orchard.Environment.Extensions.Models;
using Orchard.Environment.ShellBuilders;
using Orchard.Environment.Topology.Models;
using Orchard.Environment.Descriptor.Models;
using Orchard.Environment.ShellBuilders.Models;
namespace Orchard.Tests.Environment.ShellBuilders {
[TestFixture]
@@ -33,32 +34,32 @@ namespace Orchard.Tests.Environment.ShellBuilders {
ShellSettings CreateSettings() {
return new ShellSettings {Name = "Default"};
}
ShellTopology CreateTopology(params ShellTopologyItem[] items) {
return new ShellTopology {
Dependencies = items.OfType<DependencyTopology>(),
Controllers = items.OfType<ControllerTopology>(),
Records = items.OfType<RecordTopology>(),
ShellBlueprint CreateBlueprint(params ShellBlueprintItem[] items) {
return new ShellBlueprint {
Dependencies = items.OfType<DependencyBlueprint>(),
Controllers = items.OfType<ControllerBlueprint>(),
Records = items.OfType<RecordBlueprint>(),
};
}
DependencyTopology WithModule<T>() {
return new DependencyTopology { Type = typeof(T), Parameters = Enumerable.Empty<ShellParameter>() };
DependencyBlueprint WithModule<T>() {
return new DependencyBlueprint { Type = typeof(T), Parameters = Enumerable.Empty<ShellParameter>() };
}
ControllerTopology WithController<T>(string areaName, string controllerName) {
return new ControllerTopology { Type = typeof(T), AreaName = areaName, ControllerName = controllerName };
ControllerBlueprint WithController<T>(string areaName, string controllerName) {
return new ControllerBlueprint { Type = typeof(T), AreaName = areaName, ControllerName = controllerName };
}
DependencyTopology WithDependency<T>() {
return new DependencyTopology { Type = typeof(T), Parameters = Enumerable.Empty<ShellParameter>() };
DependencyBlueprint WithDependency<T>() {
return new DependencyBlueprint { Type = typeof(T), Parameters = Enumerable.Empty<ShellParameter>() };
}
[Test]
public void ShouldReturnChildLifetimeScopeNamedShell() {
var settings = CreateSettings();
var topology = CreateTopology();
var blueprint = CreateBlueprint();
var factory = _container.Resolve<IShellContainerFactory>();
var shellContainer = factory.CreateContainer(settings, topology);
var shellContainer = factory.CreateContainer(settings, blueprint);
Assert.That(shellContainer.Tag, Is.EqualTo("shell"));
@@ -72,12 +73,12 @@ namespace Orchard.Tests.Environment.ShellBuilders {
[Test]
public void ControllersAreRegisteredAsKeyedServices() {
var settings = CreateSettings();
var topology = CreateTopology(
var blueprint = CreateBlueprint(
WithModule<TestModule>(),
WithController<TestController>("foo", "bar"));
var factory = _container.Resolve<IShellContainerFactory>();
var shellContainer = factory.CreateContainer(settings, topology);
var shellContainer = factory.CreateContainer(settings, blueprint);
var controllers = shellContainer.Resolve<IIndex<string, IController>>();
var controller = controllers["foo/bar"];
Assert.That(controller, Is.Not.Null);
@@ -91,12 +92,12 @@ namespace Orchard.Tests.Environment.ShellBuilders {
[Test]
public void ModulesAreResolvedAndRegistered() {
var settings = CreateSettings();
var topology = CreateTopology(
var blueprint = CreateBlueprint(
WithModule<TestModule>(),
WithController<TestController>("foo", "bar"));
var factory = _container.Resolve<IShellContainerFactory>();
var shellContainer = factory.CreateContainer(settings, topology);
var shellContainer = factory.CreateContainer(settings, blueprint);
var controllerMetas = shellContainer.Resolve<IIndex<string, Meta<IController>>>();
var metadata = controllerMetas["foo/bar"].Metadata;
@@ -114,11 +115,11 @@ namespace Orchard.Tests.Environment.ShellBuilders {
[Test]
public void ModulesMayResolveHostServices() {
var settings = CreateSettings();
var topology = CreateTopology(
var blueprint = CreateBlueprint(
WithModule<ModuleUsingThatComponent>());
var factory = _container.Resolve<IShellContainerFactory>();
var shellContainer = factory.CreateContainer(settings, topology);
var shellContainer = factory.CreateContainer(settings, blueprint);
Assert.That(shellContainer.Resolve<string>(), Is.EqualTo("Module was loaded"));
}
@@ -141,11 +142,11 @@ namespace Orchard.Tests.Environment.ShellBuilders {
[Test]
public void DependenciesAreResolvable() {
var settings = CreateSettings();
var topology = CreateTopology(
var blueprint = CreateBlueprint(
WithDependency<TestDependency>());
var factory = _container.Resolve<IShellContainerFactory>();
var shellContainer = factory.CreateContainer(settings, topology);
var shellContainer = factory.CreateContainer(settings, blueprint);
var testDependency = shellContainer.Resolve<ITestDependency>();
Assert.That(testDependency, Is.Not.Null);
@@ -161,14 +162,14 @@ namespace Orchard.Tests.Environment.ShellBuilders {
[Test]
public void ExtraInformationCanDropIntoProperties() {
var settings = CreateSettings();
var topology = CreateTopology(
var blueprint = CreateBlueprint(
WithDependency<TestDependency2>());
topology.Dependencies.Single().Feature =
blueprint.Dependencies.Single().Feature =
new Feature { Descriptor = new FeatureDescriptor { Name = "Hello" } };
var factory = _container.Resolve<IShellContainerFactory>();
var shellContainer = factory.CreateContainer(settings, topology);
var shellContainer = factory.CreateContainer(settings, blueprint);
var testDependency = shellContainer.Resolve<ITestDependency>();
Assert.That(testDependency, Is.Not.Null);
@@ -187,10 +188,10 @@ namespace Orchard.Tests.Environment.ShellBuilders {
[Test]
public void ParametersMayOrMayNotBeUsedAsPropertiesAndConstructorParameters() {
var settings = CreateSettings();
var topology = CreateTopology(
var blueprint = CreateBlueprint(
WithDependency<TestDependency3>());
topology.Dependencies.Single().Parameters =
blueprint.Dependencies.Single().Parameters =
new[] {
new ShellParameter {Name = "alpha", Value = "-a-"},
new ShellParameter {Name = "Beta", Value = "-b-"},
@@ -198,7 +199,7 @@ namespace Orchard.Tests.Environment.ShellBuilders {
};
var factory = _container.Resolve<IShellContainerFactory>();
var shellContainer = factory.CreateContainer(settings, topology);
var shellContainer = factory.CreateContainer(settings, blueprint);
var testDependency = shellContainer.Resolve<ITestDependency>();
Assert.That(testDependency, Is.Not.Null);
@@ -231,20 +232,20 @@ namespace Orchard.Tests.Environment.ShellBuilders {
[Test]
public void DynamicProxyIsInEffect() {
var settings = CreateSettings();
var topology = CreateTopology(
var blueprint = CreateBlueprint(
WithModule<ProxModule>(),
WithDependency<ProxDependency>());
var factory = _container.Resolve<IShellContainerFactory>();
var shellContainer = factory.CreateContainer(settings, topology);
var shellContainer = factory.CreateContainer(settings, blueprint);
var testDependency = shellContainer.Resolve<IProxDependency>();
Assert.That(testDependency.Hello(), Is.EqualTo("Foo"));
var topology2 = CreateTopology(
var blueprint2 = CreateBlueprint(
WithDependency<ProxDependency>());
var shellContainer2 = factory.CreateContainer(settings, topology2);
var shellContainer2 = factory.CreateContainer(settings, blueprint2);
var testDependency2 = shellContainer2.Resolve<IProxDependency>();
Assert.That(testDependency2.Hello(), Is.EqualTo("World"));
@@ -281,10 +282,10 @@ namespace Orchard.Tests.Environment.ShellBuilders {
[Test]
public void DynamicProxyAndShellSettingsAreResolvableToSameInstances() {
var settings = CreateSettings();
var topology = CreateTopology();
var blueprint = CreateBlueprint();
var factory = _container.Resolve<IShellContainerFactory>();
var shellContainer = factory.CreateContainer(settings, topology);
var shellContainer = factory.CreateContainer(settings, blueprint);
var proxa = shellContainer.Resolve<DynamicProxyContext>();
var proxb = shellContainer.Resolve<DynamicProxyContext>();
@@ -297,8 +298,8 @@ namespace Orchard.Tests.Environment.ShellBuilders {
Assert.That(setta, Is.SameAs(settb));
var settings2 = CreateSettings();
var topology2 = CreateTopology();
var shellContainer2 = factory.CreateContainer(settings2, topology2);
var blueprint2 = CreateBlueprint();
var shellContainer2 = factory.CreateContainer(settings2, blueprint2);
var proxa2 = shellContainer2.Resolve<DynamicProxyContext>();
var proxb2 = shellContainer2.Resolve<DynamicProxyContext>();

View File

@@ -5,8 +5,9 @@ using NUnit.Framework;
using Orchard.Environment;
using Orchard.Environment.Configuration;
using Orchard.Environment.ShellBuilders;
using Orchard.Environment.Topology;
using Orchard.Environment.Topology.Models;
using Orchard.Environment.Descriptor;
using Orchard.Environment.Descriptor.Models;
using Orchard.Environment.ShellBuilders.Models;
using Orchard.Tests.Utility;
namespace Orchard.Tests.Environment.ShellBuilders {
@@ -25,33 +26,33 @@ namespace Orchard.Tests.Environment.ShellBuilders {
[Test]
public void NormalExecutionReturnsExpectedObjects() {
var settings = new ShellSettings { Name = "Default" };
var topologyDescriptor = new ShellDescriptor { SerialNumber = 6655321 };
var topology = new ShellTopology();
var descriptor = new ShellDescriptor { SerialNumber = 6655321 };
var blueprint = new ShellBlueprint();
var shellLifetimeScope = _container.BeginLifetimeScope("shell");
_container.Mock<IShellDescriptorCache>()
.Setup(x => x.Fetch("Default"))
.Returns(topologyDescriptor);
.Returns(descriptor);
_container.Mock<ICompositionStrategy>()
.Setup(x => x.Compose(settings, topologyDescriptor))
.Returns(topology);
.Setup(x => x.Compose(settings, descriptor))
.Returns(blueprint);
_container.Mock<IShellContainerFactory>()
.Setup(x => x.CreateContainer(settings, topology))
.Setup(x => x.CreateContainer(settings, blueprint))
.Returns(shellLifetimeScope);
_container.Mock<IShellDescriptorManager>()
.Setup(x => x.GetShellDescriptor())
.Returns(topologyDescriptor);
.Returns(descriptor);
var factory = _container.Resolve<IShellContextFactory>();
var context = factory.CreateShellContext(settings);
Assert.That(context.Settings, Is.SameAs(settings));
Assert.That(context.Descriptor, Is.SameAs(topologyDescriptor));
Assert.That(context.Topology, Is.SameAs(topology));
Assert.That(context.Descriptor, Is.SameAs(descriptor));
Assert.That(context.Blueprint, Is.SameAs(blueprint));
Assert.That(context.LifetimeScope, Is.SameAs(shellLifetimeScope));
Assert.That(context.Shell, Is.SameAs(shellLifetimeScope.Resolve<IOrchardShell>()));
}
@@ -60,7 +61,7 @@ namespace Orchard.Tests.Environment.ShellBuilders {
public void CreatingSetupContextUsesOrchardSetupFeature() {
var settings = default(ShellSettings);
var descriptor = default(ShellDescriptor);
var topology = new ShellTopology();
var blueprint = new ShellBlueprint();
_container.Mock<ICompositionStrategy>()
.Setup(x => x.Compose(It.IsAny<ShellSettings>(), It.IsAny<ShellDescriptor>()))
@@ -68,10 +69,10 @@ namespace Orchard.Tests.Environment.ShellBuilders {
settings = s;
descriptor = d;
})
.Returns(topology);
.Returns(blueprint);
_container.Mock<IShellContainerFactory>()
.Setup(x => x.CreateContainer(It.IsAny<ShellSettings>(), topology))
.Setup(x => x.CreateContainer(It.IsAny<ShellSettings>(), blueprint))
.Returns(_container.BeginLifetimeScope("shell"));
var factory = _container.Resolve<IShellContextFactory>();

View File

@@ -5,7 +5,7 @@ using NUnit.Framework;
using Orchard.Environment.Configuration;
using Orchard.Environment.ShellBuilders;
using Orchard.Environment.State;
using Orchard.Environment.Topology.Models;
using Orchard.Environment.Descriptor.Models;
using Orchard.Events;
using Orchard.Tests.Utility;

View File

@@ -1,11 +1,11 @@
using System.Linq;
using Orchard.Environment.Extensions.Models;
using Orchard.Environment.Topology.Models;
using Orchard.Environment.Descriptor.Models;
namespace Orchard.Tests.Environment.Utility {
static class Build {
public static ShellDescriptor TopologyDescriptor() {
public static ShellDescriptor ShellDescriptor() {
var descriptor = new ShellDescriptor {
Features = Enumerable.Empty<ShellFeature>(),
Parameters = Enumerable.Empty<ShellParameter>(),

View File

@@ -3,7 +3,8 @@ using System.Linq;
using System.Web.Routing;
using NUnit.Framework;
using Orchard.Environment.Extensions.Models;
using Orchard.Environment.Topology.Models;
using Orchard.Environment.Descriptor.Models;
using Orchard.Environment.ShellBuilders.Models;
using Orchard.Mvc.Routes;
namespace Orchard.Tests.Mvc.Routes {
@@ -11,9 +12,9 @@ namespace Orchard.Tests.Mvc.Routes {
public class StandardExtensionRouteProviderTests {
[Test]
public void ExtensionDisplayNameShouldBeUsedInBothStandardRoutes() {
var topology = new ShellTopology {
var blueprint = new ShellBlueprint {
Controllers = new[] {
new ControllerTopology {
new ControllerBlueprint {
AreaName ="Long.Name.Foo",
Feature =new Feature {
Descriptor=new FeatureDescriptor {
@@ -23,7 +24,7 @@ namespace Orchard.Tests.Mvc.Routes {
}
}
},
new ControllerTopology {
new ControllerBlueprint {
AreaName ="Long.Name.Bar",
Feature =new Feature {
Descriptor=new FeatureDescriptor {
@@ -35,7 +36,7 @@ namespace Orchard.Tests.Mvc.Routes {
}
}
};
var routeProvider = new StandardExtensionRouteProvider(topology);
var routeProvider = new StandardExtensionRouteProvider(blueprint);
var routes = new List<RouteDescriptor>();
routeProvider.GetRoutes(routes);

View File

@@ -203,7 +203,7 @@
<Compile Include="Stubs\StubWebSiteFolder.cs" />
<Compile Include="Utility\ContainerExtensions.cs" />
<Compile Include="Environment\TestDependencies\TestDependency.cs" />
<Compile Include="Environment\Topology\DefaultShellDescriptorCacheTests.cs" />
<Compile Include="Environment\Blueprint\DefaultShellDescriptorCacheTests.cs" />
<Compile Include="EventsTests.cs" />
<Compile Include="Events\EventTests.cs" />
<Compile Include="Environment\Extensions\ExtensionFoldersTests.cs" />