public void GetAccessKeySecret()
        {
            Core.Auth.Credential legacyCredential = new Core.Auth.Credential("foo", "bar");
            LegacyCredentials    instance         = new LegacyCredentials(legacyCredential);

            Assert.Equal("bar", instance.GetAccessKeySecret());
        }
        public void Instance()
        {
            Core.Auth.Credential legacyCredential = new Core.Auth.Credential("foo", "bar");
            LegacyCredentials    instance         = new LegacyCredentials(legacyCredential);

            Assert.IsType <LegacyCredentials>(instance);
            Assert.NotNull(instance);
        }
        public void SetExpiredDate()
        {
            Core.Auth.Credential instance;
            instance = new Core.Auth.Credential("keyId", "secret", -1);
            Assert.False(instance.IsExpired());

            instance = new Core.Auth.Credential("keyId", "secret", 1);
            Assert.True(instance.IsExpired());
        }
 public void Instance()
 {
     Core.Auth.Credential instance;
     instance = new Core.Auth.Credential();
     instance = new Core.Auth.Credential("keyId", "secret");
     instance = new Core.Auth.Credential("keyId", "secret", "securityToken");
     instance = new Core.Auth.Credential("keyId", "secret", 24);
     instance = new Core.Auth.Credential("keyId", "secret", "securityToken", 24);
     Assert.NotNull(instance);
 }
        public void IsExpired()
        {
            Core.Auth.Credential instance;
            instance             = new Core.Auth.Credential("keyId", "secret", 1);
            instance.ExpiredDate = DateTime.Now.AddDays(1);
            Assert.True(instance.IsExpired());

            instance.ExpiredDate = null;
            Assert.False(instance.IsExpired());

            instance.ExpiredDate = DateTime.Now.AddDays(-1);
            Assert.False(instance.IsExpired());
        }
        public void Instance()
        {
            Core.Auth.Credential instance;
            instance = new Core.Auth.Credential();
            instance = new Core.Auth.Credential("keyId", "secret");
            instance = new Core.Auth.Credential("keyId", "secret", "securityToken");
            instance = new Core.Auth.Credential("keyId", "secret", 24);
            instance = new Core.Auth.Credential("keyId", "secret", "securityToken", 24);

            Assert.NotNull(instance);
            Assert.Equal("keyId", instance.GetAccessKeyId());
            Assert.Equal("secret", instance.GetAccessKeySecret());
        }
        public void IClientProfileInstance()
        {
            // when securityToken is not null
            var mock = new Mock <IClientProfile>();

            Core.Auth.Credential credential = new Core.Auth.Credential("accessKeyId", "accessKeySecret", "securityToken");
            mock.Setup(foo => foo.GetCredential()).Returns(credential);
            IClientProfile            profile  = mock.Object;
            StaticCredentialsProvider instance = new StaticCredentialsProvider(profile);

            Assert.IsType <BasicSessionCredentials>(instance.GetCredentials());

            // when securityToken is null
            var mock2 = new Mock <IClientProfile>();

            Core.Auth.Credential credential2 = new Core.Auth.Credential("accessKeyId", "accessKeySecret");
            mock2.Setup(foo => foo.GetCredential()).Returns(credential2);
            IClientProfile            profile2  = mock2.Object;
            StaticCredentialsProvider instance2 = new StaticCredentialsProvider(profile2);

            Assert.IsType <LegacyCredentials>(instance2.GetCredentials());
        }