public void ShouldEnableNavigationCommand() { TestNavigationViewModel test = new TestNavigationViewModel(); bool canNavigate = false; test.NavigateForwardCommand.CanExecuteChanged += (s, e) => canNavigate = test.NavigateForwardCommand.CanExecute(null); test.PropertyChanged += (s, e) => Assert.AreEqual(PropertyName.Get<TestNavigationViewModel>(vm => vm.CanTransition), e.PropertyName); test.SetCanTransition(true); Assert.IsTrue(canNavigate); }
public void ShouldSetParentState() { TestNavigationViewModel test = new TestNavigationViewModel(); Mock<IStateViewModel> mockState = new Mock<IStateViewModel>(); Mock<IStateContext> parentMock = new Mock<IStateContext>(); parentMock.Setup(x => x.SetStateCommand).Returns(new Mock<ICommand>().SetupAllProperties().Object); test.SetNextState(mockState.Object); test.Parent = parentMock.Object; test.SetCanTransition(true); Assert.AreEqual(mockState.Object, test.GetNextState()); test.NavigateForwardCommand.Execute(null); }