public void HandleBusyMessageShouldUpdateMessageAndNotifyListinersIfModeHandleAndNotifyListeners() { const string busyMessageString = "busy..."; var viewModel = GetViewModelBase(); var childViewModel = viewModel.GetViewModel <TestViewModelBase>(observationMode: ObservationMode.None); viewModel.Subscribe(childViewModel); viewModel.Settings.HandleBusyMessageMode = HandleMode.HandleAndNotifySubscribers; var busyMessage = new BusyTokenMock(busyMessageString); IHandler <object> beginBusyHandler = viewModel; beginBusyHandler.Handle(this, busyMessage); viewModel.IsBusy.ShouldBeTrue(); viewModel.BusyMessage.ShouldEqual(busyMessageString); viewModel.BusyInfo.GetMessages().Single().ShouldEqual(busyMessageString); childViewModel.IsBusy.ShouldBeTrue(); childViewModel.BusyMessage.ShouldEqual(busyMessageString); childViewModel.BusyInfo.GetMessages().Single().ShouldEqual(busyMessageString); busyMessage.Dispose(); viewModel.IsBusy.ShouldBeFalse(); viewModel.BusyMessage.ShouldBeNull(); viewModel.BusyInfo.ShouldBeNull(); childViewModel.IsBusy.ShouldBeFalse(); childViewModel.BusyMessage.ShouldBeNull(); childViewModel.BusyInfo.ShouldBeNull(); }
public void HandleBusyMessageShouldNotUpdateMessageIfModeNone() { const string busyMessageString = "busy..."; var viewModel = GetViewModelBase(); viewModel.Settings.HandleBusyMessageMode = HandleMode.None; var busyMessage = new BusyTokenMock(busyMessageString); IHandler <object> beginBusyHandler = viewModel; beginBusyHandler.Handle(this, busyMessage); viewModel.IsBusy.ShouldBeFalse(); viewModel.BusyMessage.ShouldBeNull(); }
public void HandleBusyMessageShouldUpdateMessageIfModeHandle() { const string busyMessageString = "busy..."; var viewModel = GetViewModelBase(); viewModel.Settings.HandleBusyMessageMode = HandleMode.Handle; var busyMessage = new BusyTokenMock(busyMessageString); IHandler <object> beginBusyHandler = viewModel; beginBusyHandler.Handle(this, busyMessage); viewModel.IsBusy.ShouldBeTrue(); viewModel.BusyInfo.GetMessages().Single().ShouldEqual(busyMessageString); viewModel.BusyMessage.ShouldEqual(busyMessageString); busyMessage.Dispose(); viewModel.BusyInfo.ShouldBeNull(); viewModel.IsBusy.ShouldBeFalse(); viewModel.BusyMessage.ShouldBeNull(); }