Exemplo n.º 1
0
        public void EncryptDecrypt()
        {
            var token = new OAuthToken
            {
                AccessToken  = "12345",
                AppSecret    = "67890",
                AuthorizeUrl = new Uri("https://authorize.url"),
                CreatedOn    = DateTime.Now,
                ExpiresIn    = 900,
                RefreshToken = "1234567890",
                TokenType    = "jwt-bearer"
            };

            var key = Guid.NewGuid();

            var encrypted = token.Encrypt(key.ToString());
            var decrypted = encrypted.Decrypt <OAuthToken>(key.ToString());

            decrypted.ShouldBeEquivalentTo(token);
        }