public IActionResult Delete(int IdAccessToken)
 {
     try {
         //Console.WriteLine("ok " + IdAccessToken);
         repositorio.Delete(IdAccessToken);
         return(this.Ok("AccessToken " + IdAccessToken + " deletado."));
     }
     catch (Exception ex) {
         Console.WriteLine(ex.Message);
         return(BadRequest());
     }
 }
Example #2
0
        public void Delete_NotThrowsException_StateIsValid()
        {
            var now         = DateUtil.Now;
            var accessToken = new AccessTokenTableEntity
            {
                TokenId       = new string('Y', 100),
                Name          = new string('X', 100),
                Description   = new string('X', 400),
                ApplicationId = Guid.NewGuid(),
                PrincipalType = PrincipalType.Application.ToString(),
                PrincipalId   = Guid.NewGuid(),
                Scopes        = new string('X', 8000),
                Status        = AccessTokenStatus.SUSPENDED.ToString(),
                ExpiryTime    = DateTimeOffset.MaxValue,
                CreateTime    = DateTimeOffset.MaxValue,
                UpdateTime    = DateTimeOffset.MaxValue,
            };
            var accessTokenRepository = new AccessTokenRepository(TestEnvironment.DBSettings);

            accessTokenRepository.Create(accessToken);
            Assert.IsTrue(accessTokenRepository.Delete(accessToken));
        }