public async Task CreateCase(string installation, string informer, string errorDescription) { bool error = false; if (string.IsNullOrEmpty(installation)) { _view.ShowMissingInfoError(); _view.SetInstallationError(); error = true; } else if (string.IsNullOrEmpty(informer)) { _view.ShowMissingInfoError(); _view.SetInformerError(); error = true; } else if (string.IsNullOrEmpty(errorDescription)) { _view.ShowMissingInfoError(); _view.SetErrorDescriptionError(); error = true; } if (!error) { _view.ShowProgressDialog(); var caseCreated = await Task.Factory.StartNew(() => _model.CreateCase(installation, informer, errorDescription)); if (caseCreated) { _view.HideProgressDialog(); _view.CaseCreated(); } else { _view.HideProgressDialog(); _view.CaseNotCreated(); } } }
public void CreateCase_ValidInfo_HideProgressDialogCalled() { _fakeModel.CreateCase("Valid", "Valid", "Valid").Returns(true); _uut.CreateCase("Valid", "Valid", "Valid").Wait(); _fakeView.Received().HideProgressDialog(); }