public CreateAccountPageViewModel(Frame rootFrame, User user = null)
        {
            _rootFrame = rootFrame;
            IsLoading = false;

            User = user ?? new User();
            User.IdentificationService = "1";
            CreateAccountCommand = new RelayCommand(() => { CreateAccount(); });
        }
        public LoginPageViewModel(Frame rootFrame, User user = null)
        {
            _rootFrame = rootFrame;
            IsLoading = false;

            User = user ?? new User();

            LoginCommand = new RelayCommand(() => { Login(); });
            CreateAccountCommand = new RelayCommand(() => { CreateUSer(); });
        }
        public void ValidateFieldsTest_EmptyPassword()
        {
            User user = new User
            {
                Email = "*****@*****.**",
                Password = "",
                FirstName = "test1",
                LastName = "test2",
            };

            var result = user.ValidateLogin();
            Assert.AreEqual(eValidationValues.PasswordEmpty, result, "Login: Validate fields with empty password success");
        }
        public void ValidateFieldsTest_UnvalidEmail()
        {
            User user = new User
            {
                Email = "test",
                Password = "******",
                FirstName = "test1",
                LastName = "test2",
            };

            var result = user.ValidateLogin();
            Assert.AreEqual(eValidationValues.EmailInvalid, result, "Login: Validate fields with invalid email success");
        }
        public void ValidateFieldsTest_Valid()
        {
            User user = new User
            {
                Email = "*****@*****.**",
                Password = "******",
                FirstName = "test1",
                LastName= "test2",
            };

            var result = user.ValidateLogin();
            Assert.AreEqual(eValidationValues.Valid, result, "Login: Validate fields with correct values success");
        }
        public void ValidateFieldsTest_EmptyEmail()
        {
            User user = new User
            {
                Email = "",
                Password = "******"
            };

            var result = user.ValidateLogin();
            Assert.AreEqual(eValidationValues.EmailAddressEmpty, result, "Login: Validate fields with empty email success");
        }
Exemplo n.º 7
0
 public async Task<User> Create(User user)
 {
     return await RestApiHelper.ExecuteAsync<User, User>(user, ApiEndpoints.CreateUser, HttpMethod.Post);
 }
Exemplo n.º 8
0
 public async Task<User> LogIn(User user)
 {
     return await RestApiHelper.ExecuteAsync<User, User>(user, ApiEndpoints.Login, HttpMethod.Post);
 }