예제 #1
0
        public void HashPassword()
        {
            var sut  = new UserPasswordService();
            var hash = sut.HashPassword("123456");

            Assert.NotEmpty(hash);
        }
예제 #2
0
        public void HashPasswordAndTest()
        {
            var sut  = new UserPasswordService();
            var hash = sut.HashPassword("123456");

            Assert.NotEmpty(hash);
            var user = new User
            {
                Password = hash
            };

            Assert.True(sut.ComparePassword(user, "123456"));
        }
예제 #3
0
        public async Task <ApplicationStatus> InitializedApplicationAsync(string Name, string EmailAddress, string PhoneNumber, string Password)
        {
            var user = new User()
            {
                Name         = Name,
                EmailAddress = EmailAddress,
                PhoneNumber  = PhoneNumber
            };

            var password = new UserPassword()
            {
                Password = _userPasswordService.HashPassword(user, Password)
            };

            _ctx.Users.Add(user);
            _ctx.UserPasswords.Add(password);

            await _ctx.SaveChangesAsync();

            return(await GetApplicationStatusAsync());
        }