public void MessengerPropertySet_MultipleLocomotivesPassed_HeaderSet() { _addDataParams.Setup(m => m.ReadLocomotives). Returns(new List <ILocomotive>() { new LocomotiveMock() { Name = "Bobo" }, new LocomotiveMock() { Name = "Lulu" }, new LocomotiveMock() { Name = "Momo" } }); _viewModel = new CopyProgressViewModel(_repository.Object); _viewModel.StartMessaging(_messenger); _messenger.Send(new SetViewModelParametersMessage <IAddDataParameters>(_addDataParams.Object)); Assert.That(_viewModel.Header, Is.EqualTo("Bobo, Lulu, Momo")); }
public void MessengerPropertySet_OneLocomotivePassed_HeaderSet() { _viewModel = new CopyProgressViewModel(_repository.Object); _viewModel.StartMessaging(_messenger); _messenger.Send(new SetViewModelParametersMessage <IAddDataParameters>(_addDataParams.Object)); Assert.That(_viewModel.Header, Is.EqualTo("Bobo")); }
public void MessengerPropertySet_FaultsAndPsnLogsStringSet() { _viewModel = new CopyProgressViewModel(_repository.Object); _viewModel.StartMessaging(_messenger); _messenger.Send(new SetViewModelParametersMessage <IAddDataParameters>(_addDataParams.Object)); Assert.That(_viewModel.FaultsString, Is.EqualTo("Копируется аварий: 2")); Assert.That(_viewModel.PsnLogString, Is.EqualTo("Копируется дампов магистрали ПСН: 2")); }
public void MessengerPropertySet_SaveDataAsyncCalledAndCanNotClose() { bool closeMessageSent = false; _messenger.Register <ViewMessage>(this, Views.Views.CopyProggress, message => { closeMessageSent = true; }); _viewModel = new CopyProgressViewModel(_repository.Object); _viewModel.StartMessaging(_messenger); _messenger.Send(new SetViewModelParametersMessage <IAddDataParameters>(_addDataParams.Object)); _viewModel.Close.Execute(null); _repository.Verify(); Assert.That(closeMessageSent, Is.False); // должно быть false, т.к процесс копирования не закончен }
public void MessengerPropertySet_CompleteResultIsError_ErrorDialogMessageSent() { InitializeSaveDataAsyncMock(true, OnCompleteEventArgs.CompleteResult.Error); bool dialogShown = false; bool closeMessageSent = false; _messenger.Register <DialogMessage>(this, AppMessages.CopyProgressError, message => { dialogShown = true; }); _messenger.Register <ViewMessage>(this, Views.Views.CopyProggress, message => { closeMessageSent = true; }); _viewModel = new CopyProgressViewModel(_repository.Object); _viewModel.StartMessaging(_messenger); _messenger.Send(new SetViewModelParametersMessage <IAddDataParameters>(_addDataParams.Object)); _viewModel.Close.Execute(null); Assert.That(dialogShown, Is.True); Assert.That(closeMessageSent, Is.True); }
public void MessengerPropertySet_CompleteResultIsOk_FaultsStringSetAndCanClose() { InitializeSaveDataAsyncMock(true, OnCompleteEventArgs.CompleteResult.Ok); bool dialogShown = false; bool closeMessageSent = false; _messenger.Register <DialogMessage>(this, AppMessages.CopyProgressError, message => { dialogShown = true; }); _messenger.Register <ViewMessage>(this, Views.Views.CopyProggress, message => { closeMessageSent = true; }); _viewModel = new CopyProgressViewModel(_repository.Object); _viewModel.StartMessaging(_messenger); _messenger.Send(new SetViewModelParametersMessage <IAddDataParameters>(_addDataParams.Object)); _viewModel.Close.Execute(null); Assert.That(dialogShown, Is.False); Assert.That(closeMessageSent, Is.True); Assert.That(_viewModel.Progress, Is.EqualTo(100)); Assert.That(_viewModel.FaultsString, Is.EqualTo("Скопировано аварий: 2")); Assert.That(_viewModel.PsnLogString, Is.EqualTo("Скопировано дампов магистрали ПСН: 2")); }