private async void CreateRideCommandExecuteAsync() { IsBusy = true; CreateRideResponse response = await _backendApiService.SubmitCreateRideRequest(Request); IsBusy = false; //Debug.WriteLine(response.HttpResponseMessage.StatusCode); if (response == null) { await DialogService.DisplayAlertAsync("Forbindelse", "Du har ikke forbindelse til internettet", "OK"); } else if (response.WasUnsuccessfull()) { await DialogService.DisplayAlertAsync("Fejl", response.Body.errors.First().Value[0], "OK"); } else if (response.WasSuccessfull()) { await DialogService.DisplayAlertAsync("Success", "Turen er blevet oprettet \nAt betale: " + response.Body.price + " kr.", "OK"); await NavigationService.GoBackAsync(); } }
public void CreateRideCommand_ApiReturnsNull_DialogServiceShowsMessage() { _fakeBackendApiService.SubmitCreateRideRequest(_uut.Request).ReturnsNull(); _uut.CreateRideCommand.Execute(); _fakePageDialogService.Received().DisplayAlertAsync("Forbindelse", Arg.Any <string>(), Arg.Any <string>()); }