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

            // act
            context.Register("joao", "123456", "123455");

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

            // act
            context.Register("felipe", "123456", "123456");

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

            // act
            context.ChangePassword("Felipe", "123455", "2222", "2222");

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

            // act
            context.ChangePassword("Joao", "123456", "2222", "2222");

            // assert
        }
예제 #5
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
        }
예제 #6
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
        }
예제 #7
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);
        }
예제 #8
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);
        }