mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
- Marking event test cases relying on old event handler system as obsolete.
--HG-- branch : dev
This commit is contained in:
@@ -24,25 +24,6 @@ namespace Orchard.Tests.Events {
|
|||||||
_eventBus = _container.Resolve<IEventBus>();
|
_eventBus = _container.Resolve<IEventBus>();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void EventsAreCorrectlyDispatchedToHandlers() {
|
|
||||||
Assert.That(_eventBusHandler.LastMessageName, Is.Null);
|
|
||||||
_eventBus.Notify_Obsolete("Notification", new Dictionary<string, string>());
|
|
||||||
Assert.That(_eventBusHandler.LastMessageName, Is.EqualTo("Notification"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public class StubEventBusHandler : IEventBusHandler {
|
|
||||||
public string LastMessageName { get; set; }
|
|
||||||
|
|
||||||
#region Implementation of IEventBusHandler
|
|
||||||
|
|
||||||
public void Process(string messageName, IDictionary<string, string> eventData) {
|
|
||||||
LastMessageName = messageName;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void EventsAreCorrectlyDispatchedToEventHandlers() {
|
public void EventsAreCorrectlyDispatchedToEventHandlers() {
|
||||||
Assert.That(_eventHandler.Count, Is.EqualTo(0));
|
Assert.That(_eventHandler.Count, Is.EqualTo(0));
|
||||||
@@ -92,5 +73,24 @@ namespace Orchard.Tests.Events {
|
|||||||
Result = a - b;
|
Result = a - b;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void EventsAreCorrectlyDispatchedToHandlers_Obsolete() {
|
||||||
|
Assert.That(_eventBusHandler.LastMessageName, Is.Null);
|
||||||
|
_eventBus.Notify_Obsolete("Notification", new Dictionary<string, string>());
|
||||||
|
Assert.That(_eventBusHandler.LastMessageName, Is.EqualTo("Notification"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public class StubEventBusHandler : IEventBusHandler {
|
||||||
|
public string LastMessageName { get; set; }
|
||||||
|
|
||||||
|
#region Implementation of IEventBusHandler
|
||||||
|
|
||||||
|
public void Process(string messageName, IDictionary<string, string> eventData) {
|
||||||
|
LastMessageName = messageName;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user