public void IsExpired()
 {
     IClientProfile profile = DefaultProfile.GetProfile("cn-shanghai", "accessKeyId", "accessKeySecret");
     DefaultAcsClient client = new DefaultAcsClient(profile);
     var provider = new StaticCredentialsProvider(profile);
     CredentialsBackupCompatibilityAdaptor instance = new CredentialsBackupCompatibilityAdaptor(provider);
     Assert.False(instance.IsExpired());
 }
Ejemplo n.º 2
0
        public void GetAccessKeySecret()
        {
            IClientProfile profile  = DefaultProfile.GetProfile("cn-shanghai", "accessKeyId", "accessKeySecret");
            var            client   = new DefaultAcsClient(profile);
            var            provider = new StaticCredentialsProvider(profile);
            var            instance = new CredentialsBackupCompatibilityAdaptor(provider);

            Assert.Equal("accessKeySecret", instance.GetAccessSecret());
        }
 public void Get()
 {
     IClientProfile profile = DefaultProfile.GetProfile("cn-shanghai", "accessKeyId", "accessKeySecret");
     DefaultAcsClient client = new DefaultAcsClient(profile);
     var provider = new StaticCredentialsProvider(profile);
     CredentialsBackupCompatibilityAdaptor instance = new CredentialsBackupCompatibilityAdaptor(provider);;
     Assert.IsType<int>(instance.GetHashCode());
     instance.GetType();
     Assert.IsType<Aliyun.Acs.Core.Auth.CredentialsBackupCompatibilityAdaptor>(instance);
 }
        public void GetSecurityToken()
        {
            IClientProfile profile = DefaultProfile.GetProfile("cn-shanghai", "accessKeyId", "accessKeySecret");
            DefaultAcsClient client = new DefaultAcsClient(profile);
            var provider = new StaticCredentialsProvider(profile);
            CredentialsBackupCompatibilityAdaptor instance = new CredentialsBackupCompatibilityAdaptor(provider);
            Assert.Null(instance.GetSecurityToken());

            profile = DefaultProfile.GetProfile("cn-shanghai", "accessKeyId", "accessKeySecret");
            profile.GetCredential().SecurityToken = "some string";
            client = new DefaultAcsClient(profile);
            provider = new StaticCredentialsProvider(profile);
            instance = new CredentialsBackupCompatibilityAdaptor(provider);
            Assert.NotNull(instance.GetSecurityToken());

        }