public async Task InterestedViewModelAutomaticallyBeingRemovedWhenClosed() { ViewModelManager.ClearAll(); var viewModel = new ManagedViewModel(typeof(InterestingViewModel)); var interestingViewModel = new InterestingViewModel(); var interestedViewModel = new InterestedViewModel(); viewModel.AddViewModelInstance(interestingViewModel); viewModel.AddInterestedViewModel(interestedViewModel); interestingViewModel.InterestingValue = "new value"; Assert.AreEqual("new value", interestedViewModel.InterestedValue); await interestedViewModel.CloseViewModel(null); interestingViewModel.InterestingValue = "new value which has changed"; Assert.AreNotEqual("new value which has changed", interestedViewModel.InterestedValue); Assert.AreEqual("new value", interestedViewModel.InterestedValue); await interestingViewModel.CloseViewModel(false); await interestedViewModel.CloseViewModel(false); }
public void InterestingViewModelPropertyChanged() { ViewModelManager.ClearAll(); var viewModel = new ManagedViewModel(typeof(InterestingViewModel)); var interestingViewModel = new InterestingViewModel(); var interestedViewModel = new InterestedViewModel(); viewModel.AddViewModelInstance(interestingViewModel); viewModel.AddInterestedViewModel(interestedViewModel); interestingViewModel.InterestingValue = "new value"; Assert.AreEqual("new value", interestedViewModel.InterestedValue); interestingViewModel.CloseViewModel(false); interestedViewModel.CloseViewModel(false); }
public void InterestingViewModelCommandExecutedWithCommandParameter() { ViewModelManager.ClearAll(); var viewModel = new ManagedViewModel(typeof(InterestingViewModel)); var interestingViewModel = new InterestingViewModel(); var interestedViewModel = new InterestedViewModel(); viewModel.AddViewModelInstance(interestingViewModel); viewModel.AddInterestedViewModel(interestedViewModel); interestingViewModel.TestCommand.Execute("parameter"); Assert.AreEqual(true, interestedViewModel.CommandHasBeenExecuted); Assert.AreEqual(true, interestedViewModel.CommandHasBeenExecutedWithParameter); interestingViewModel.CloseViewModel(false); interestedViewModel.CloseViewModel(false); }
public async Task InterestingViewModelCommandExecuted() { ViewModelManager.ClearAll(); var viewModel = new ManagedViewModel(typeof(InterestingViewModel)); var interestingViewModel = new InterestingViewModel(); var interestedViewModel = new InterestedViewModel(); viewModel.AddViewModelInstance(interestingViewModel); viewModel.AddInterestedViewModel(interestedViewModel); interestingViewModel.TestCommand.Execute(null); Assert.AreEqual(true, interestedViewModel.CommandHasBeenExecuted); Assert.AreEqual(false, interestedViewModel.CommandHasBeenExecutedWithParameter); await interestingViewModel.CloseViewModelAsync(false); await interestedViewModel.CloseViewModelAsync(false); }
public void AddInterestedViewModel_Null() { ViewModelManager.ClearAll(); var viewModel = new ManagedViewModel(typeof(InterestingViewModel)); ExceptionTester.CallMethodAndExpectException <ArgumentNullException>(() => viewModel.AddInterestedViewModel(null)); }