public void LoginCommand_NoInternetConnection_ErrorDialogIsCalled()
        {
            // Arrange
            _fakeApiService.SubmitLoginRequest(_uut.Request).ReturnsNull();

            // Act
            _uut.LoginCommand.Execute();

            // Assert
            _fakePageDialogService.Received().DisplayAlertAsync(Arg.Any <string>(), Arg.Any <string>(), Arg.Any <string>());
        }
Пример #2
0
        private async void LoginCommandExecuteAsync()
        {
            IsBusy = true;
            LoginResponse response = await _backendApiService.SubmitLoginRequest(Request);

            IsBusy = false;

            if (response == null)
            {
                await DialogService.DisplayAlertAsync("Fejl", "Ingen forbindelse til internettet", "OK");
            }
            else if (response.WasUnsuccessfull())
            {
                await DialogService.DisplayAlertAsync("Ukendt fejl", "Du kunne ikke logges ind", "OK");
            }
            else
            {
                _sessionService.Update(response.Body.token, new Customer(response.Body.customer));

                await NavigationService.NavigateAsync("/" + nameof(CustomerMasterDetailPage) + "/" + nameof(NavigationPage) + "/" + nameof(RidesPage));
            }
        }