예제 #1
0
        public void ChangePassword_Password_ConfirmPassword_Differents()
        {
            // arrange
            var userRepo = new UserRepoFake();
            var context  = new UserService(userRepo);

            // act
            context.ChangePassword("felipe", "123456", "2222", "2223");
            var result = userRepo.GetByUserName("felipe");

            // assert
        }
예제 #2
0
        public void ChangePassword_Password_Null()
        {
            // arrange
            var userRepo = new UserRepoFake();
            var context  = new UserService(userRepo);

            // act
            context.ChangePassword("felipe", "123456", null, "2222");
            var result = userRepo.GetByUserName("felipe");

            // assert
        }
예제 #3
0
        public void ChangePassword_Valid()
        {
            // arrange
            var userRepo = new UserRepoFake();
            var context  = new UserService(userRepo);

            // act
            context.ChangePassword("felipe", "123456", "2222", "2222");
            var result = userRepo.GetByUserName("felipe");

            // assert
            Assert.IsNotNull(result);
            Assert.AreEqual("2222".Encrypt(), result.Password);
        }
예제 #4
0
        public void Register_Valid()
        {
            // arrange
            var userRepo = new UserRepoFake();
            var context  = new UserService(userRepo);

            // act
            context.Register("Joao", "123456", "123456");
            var result = userRepo.GetByUserName("Joao");

            // assert
            Assert.IsNotNull(result);
            Assert.AreEqual("123456".Encrypt(), result.Password);
            Assert.AreEqual(true, result.Active);
        }