Пример #1
0
 public void getAccessTokensTest()
 {
     using (Tokenio.User.TokenClient tokenClient = TestUtil.CreateClient())
     {
         UserMember grantor      = tokenClient.CreateMemberBlocking(TestUtil.RandomAlias());
         string     accountId    = grantor.CreateTestBankAccountBlocking(1000, "EUR").Id();
         Alias      granteeAlias = TestUtil.RandomAlias();
         UserMember grantee      = tokenClient.CreateMemberBlocking(granteeAlias);
         Token      createdToken = CreateAndEndorseAccessTokenSample.CreateAccessToken(grantor, accountId, granteeAlias);
         Token      foundToken   = ReplaceAccessTokenSample.FindAccessToken(tokenClient, grantor, granteeAlias);
         Assert.Equal(foundToken.Id, createdToken.Id);
     }
 }
Пример #2
0
        public void CancelAccessTokenByGrantorTest()
        {
            using (Tokenio.User.TokenClient tokenClient = TestUtil.CreateClient())
            {
                Tokenio.User.Member grantor = tokenClient.CreateMemberBlocking(TestUtil.RandomAlias());
                string accountId            = grantor.CreateTestBankAccountBlocking(1000.0, "EUR").Id();
                Alias  granteeAlias         = TestUtil.RandomAlias();
                Tokenio.User.Member grantee = tokenClient.CreateMemberBlocking(granteeAlias);

                Token token = CreateAndEndorseAccessTokenSample.CreateAccessToken(grantor, accountId, granteeAlias);
                TokenOperationResult result = CancelAccessTokenSample.CancelAccessToken(grantor, token.Id);
                Assert.Equal(TokenOperationResult.Types.Status.Success, result.Status);
            }
        }
Пример #3
0
 public void ReplaceAccessTokenTest()
 {
     using (Tokenio.User.TokenClient tokenClient = TestUtil.CreateClient())
     {
         UserMember grantor      = tokenClient.CreateMemberBlocking(TestUtil.RandomAlias());
         string     accountId    = grantor.CreateTestBankAccountBlocking(1000, "EUR").Id();
         Alias      granteeAlias = TestUtil.RandomAlias();
         UserMember grantee      = tokenClient.CreateMemberBlocking(granteeAlias);
         CreateAndEndorseAccessTokenSample.CreateBalanceAccessToken(grantor, accountId, granteeAlias);
         Token activeToken = ReplaceAccessTokenSample.FindAccessToken(tokenClient, grantor, granteeAlias);
         ReplaceAccessTokenSample.ReplaceAccessToken(grantor, granteeAlias, activeToken);
         Assert.NotEqual(ReplaceAccessTokenSample.FindAccessToken(tokenClient, grantor, granteeAlias).Id,
                         activeToken.Id);
     }
 }
Пример #4
0
 public void CreateAccessTokenTest()
 {
     using (Tokenio.User.TokenClient tokenClient = TestUtil.CreateClient())
     {
         UserMember grantor      = tokenClient.CreateMemberBlocking(TestUtil.RandomAlias());
         string     accountId    = grantor.CreateTestBankAccountBlocking(1000, "EUR").Id();
         Alias      granteeAlias = TestUtil.RandomAlias();
         UserMember grantee      = tokenClient.CreateMemberBlocking(granteeAlias);
         Token      token        = CreateAndEndorseAccessTokenSample.CreateBalanceAccessToken(
             grantor,
             accountId,
             granteeAlias);
         Assert.NotNull(token);
     }
 }