public void EnterBusyModeEmptiesNotification() { var model = new TermListViewModelDraft(); model.FillNotification(); Assert.IsNotNull(model.Notification); model.InvokeEnterBusyMode(); Assert.IsNull(model.Notification); }
public void EnterExitBusyModeTogglesIsBusy() { var model = new TermListViewModelDraft(); Assert.AreEqual(false, model.IsBusy); model.InvokeEnterBusyMode(); Assert.AreEqual(true, model.IsBusy); model.InvokeExitBusyMode(); Assert.AreEqual(false, model.IsBusy); }
public void EnterExitBusyModeConsiderNesting() { var model = new TermListViewModelDraft(); var busyModeChangeCount = 0; model.PropertyChanged += (sender, e) => busyModeChangeCount++; // Verify that IsBusy changed only once. model.InvokeEnterBusyMode(); model.InvokeEnterBusyMode(); model.InvokeEnterBusyMode(); Assert.AreEqual(1, busyModeChangeCount); busyModeChangeCount = 0; // Verify that IsBusy changed only once. model.InvokeExitBusyMode(); model.InvokeExitBusyMode(); model.InvokeExitBusyMode(); Assert.AreEqual(1, busyModeChangeCount); }
public void EnterBusyModeDisablesRecreateStorageCommand() { var service = this._termsServiceMock; service .Setup(s => s.LoadTerms(ThreadPoolScheduler.Instance)) .Returns(() => Observable.Throw <IEnumerable <Term> >(new InvalidTermsStorageException("Invalid"))); var editModel = Mock.Of <ITermEditViewModel>(); var listModel = new TermListViewModelDraft(service.Object, editModel); DispatcherHelper.ProcessCurrentQueue(); Assert.IsTrue(listModel.RecreateStorage.CanExecute(null)); listModel.InvokeEnterBusyMode(); Assert.IsFalse(listModel.RecreateStorage.CanExecute(null)); }