コード例 #1
0
        public void Auth_DoNotPassUser()
        {
            UserValidation userValidation = this.CreateUserValidation();

            subServiceUserRepository.CheckUser("A", "B").Returns(false);

            Assert.Throws <UnauthorizedAccessException>(() => userValidation.Auth("A", "B"));
        }
コード例 #2
0
        public void Auth_PassUser()
        {
            UserValidation userValidation = this.CreateUserValidation();

            subServiceUserRepository.CheckUser("A", "B").Returns(true);

            var token = userValidation.Auth("A", "B");

            Assert.IsNotEmpty(token);
        }
コード例 #3
0
        public void ValidateToken_PassUser()
        {
            UserValidation userValidation = this.CreateUserValidation();

            subServiceUserRepository.CheckUser("A", "B").Returns(true);
            var token = userValidation.Auth("A", "B");

            var res = userValidation.ValidateToken(token);

            Assert.IsTrue(res);
        }