mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Working on feature activation lifecycle
Rationalizing some record names Adding a shell feature concept, with Install and Enable states of rising/up/falling/down Host has capability of firing a named event with an explicit configuration - needed for controlled execution of rising/falling state changes notifications --HG-- branch : dev
This commit is contained in:
@@ -5,6 +5,7 @@ using Autofac;
|
||||
using NUnit.Framework;
|
||||
using Orchard.Core.Settings.Topology;
|
||||
using Orchard.Core.Settings.Topology.Records;
|
||||
using Orchard.Environment.State;
|
||||
using Orchard.Environment.Topology;
|
||||
using Orchard.Environment.Topology.Models;
|
||||
using Orchard.Events;
|
||||
@@ -34,9 +35,9 @@ namespace Orchard.Tests.Modules.Settings.Topology {
|
||||
protected override IEnumerable<Type> DatabaseTypes {
|
||||
get {
|
||||
return new[] {
|
||||
typeof (TopologyRecord),
|
||||
typeof (TopologyFeatureRecord),
|
||||
typeof (TopologyParameterRecord),
|
||||
typeof (ShellDescriptorRecord),
|
||||
typeof (ShellFeatureRecord),
|
||||
typeof (ShellParameterRecord),
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -142,5 +143,21 @@ namespace Orchard.Tests.Modules.Settings.Topology {
|
||||
|
||||
Assert.That(eventBus.LastMessageName, Is.EqualTo("IShellDescriptorManagerEventHandler.Changed"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ManagerReturnsStateForFeaturesInDescriptor() {
|
||||
var descriptorManager = _container.Resolve<IShellDescriptorManager>();
|
||||
var stateManager = _container.Resolve<IShellStateProvider>();
|
||||
var state = stateManager.GetShellState();
|
||||
Assert.That(state.Features.Count(), Is.EqualTo(0));
|
||||
descriptorManager.UpdateShellDescriptor(
|
||||
0,
|
||||
new[]{new ShellFeature{ Name="Foo"}},
|
||||
Enumerable.Empty<ShellParameter>());
|
||||
|
||||
var state2 = stateManager.GetShellState();
|
||||
Assert.That(state2.Features.Count(), Is.EqualTo(1));
|
||||
Assert.That(state2.Features, Has.Some.Property("Name").EqualTo("Foo"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user