Exemplo n.º 1
0
        public async Task VerifyServiceGetsCalledWithCorrectParameters()
        {
            var authService = new Mock <IAuthenticationService>();
            var viewModel   = new RegistrationViewModel(authService.Object)
            {
                FirstName      = "1",
                LastName       = "2",
                Email          = "3",
                Username       = "******",
                Password       = "******",
                PasswordRepeat = "5"
            };

            await viewModel.Register();

            authService.Verify(s => s.Register("1", "2", "3", "5", "4"), Times.Once);
        }
Exemplo n.º 2
0
        async void buttonSignUp_Clicked(System.Object sender, System.EventArgs e)
        {
            _registrationIsCorrect = !string.IsNullOrEmpty(txtUser.Text) && !string.IsNullOrEmpty(txtPass.Text) &&
                                     !string.IsNullOrEmpty(txtConfirmPass.Text) && !string.IsNullOrEmpty(txtEmail.Text) &&
                                     (txtPass.Text == txtConfirmPass.Text);

            if (_registrationIsCorrect)
            {
                var result = await _registrationViewModel.Register();

                if (result)
                {
                    App.Current.MainPage = new Login();
                }

                else
                {
                    userError.IsVisible = passwordError.IsVisible = confirmError.IsVisible = emailError.IsVisible = true;
                }
            }
        }