Created
October 11, 2010 00:25
-
-
Save glennblock/619758 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.Practices.Composite.Presentation.Events; | |
using Microsoft.Practices.Composite.Regions; | |
using Microsoft.Practices.Unity; | |
namespace SomeNamespace | |
{ | |
public class SomeViewModel | |
{ | |
private readonly IUnityContainer _container; | |
private readonly IEventAggregator _eventAggregator; | |
private readonly IRegionManager _regionManager; | |
public ShellViewModel(IUnityContainer container, IEventAggregator eventAggregator, IRegionManager regionManager) | |
{ | |
_container = container; | |
_eventAggregator = eventAggregator; | |
_regionManager = regionManager; | |
_eventAggregator.Subscribe<SomeEventPayload>(SomeAction, ThreadOption.UIThread, true); | |
} | |
} | |
[TestFixture] | |
public class ShellViewModelTests { | |
[Test] | |
public void when_vm_is_created_then_subscribes_to_SomeEvent() { | |
var ea = new Mock<IEventAggregator>(); | |
var vm = new ShellViewModel(null, ea, null); | |
ea.Verify.... //verify that Subscribe was called on EA which Subscribe calls | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment