public void ShouldNotAllowToNavigateToViewWhenProvidedRegionDoesNotExist() { // Given var regionCollection = new TestRegionCollection(); var regionManagerMock = new Mock <IRegionManager>(); var notExistingRegionName = Guid.NewGuid().ToString(); regionManagerMock.SetupGet(r => r.Regions).Returns(regionCollection); var command = new NavigateToProcessingChainElementCustomizationViewCommand(regionManagerMock.Object, notExistingRegionName, _viewLocator); // When // Then Assert.IsFalse(command.CanExecute(_chainElementTemplate)); Assert.Throws <CannotExecuteCommandException>(() => command.Execute(_chainElementTemplate)); }
public void ShouldNotAllowToChangeRegionsViewProvidedNotRegisteredRegionToNavigate() { // Given var regionCollection = new TestRegionCollection(); var regionManagerMock = new Mock <IRegionManager>(); var notExistingRegionName = Guid.NewGuid().ToString(); regionManagerMock.SetupGet(r => r.Regions).Returns(regionCollection); IChangeRegionsViewCommand <string> command = new ChangeRegionsViewCommand <string>(regionManagerMock.Object, notExistingRegionName); // When // Then Assert.IsFalse(command.CanExecute(_viewName)); Assert.Throws <CannotExecuteCommandException>(() => command.Execute(_viewName)); }
public void SetUp() { _viewLocator = new TestViewLocator(); _chainElementTemplate = new TestChainElementTemplateTemplateTemplateTemplate(); _regionName = "Test Region"; _regionMock = new Mock <IRegion>(); _regionMock.SetupGet(r => r.Name).Returns(_regionName); _regionMock.SetupGet(r => r.Views).Returns(new TestViewsCollection()); var regionCollection = new TestRegionCollection { _regionMock.Object }; _regionManagerMock = new Mock <IRegionManager>(); _regionManagerMock.SetupGet(r => r.Regions).Returns(regionCollection); }
public void SetUp() { _regionName = "Test Region"; _viewName = nameof(TestView); _regionMock = new Mock <IRegion>(); _regionMock.SetupGet(r => r.Name).Returns(_regionName); _regionMock.SetupGet(r => r.Views).Returns(new TestViewsCollection()); var regionCollection = new TestRegionCollection { _regionMock.Object }; _regionManagerMock = new Mock <IRegionManager>(); _regionManagerMock.SetupGet(r => r.Regions).Returns(regionCollection); _eventAggregator = new Mock <IEventAggregator>().Object; }