示例#1
0
        public void S3ExistsPrefixExists()
        {
            if (!IsEmpty)
            {
                string prefix = Guid.NewGuid().ToString();
                string key = String.Concat(prefix, "/jquery-min.js");

                PutObjectRequest request = new PutObjectRequest()
                    .WithBucketName(BucketName)
                    .WithKey(key)
                    .WithFilePath(@"script\jquery.min.js");

                using (PutObjectResponse response = Client.PutObject(request))
                {
                    cleanupKeys.Add(key);
                }

                S3PrefixExists task = new S3PrefixExists()
                {
                    AccessKeyId = AccessKeyId,
                    BucketName = BucketName,
                    Prefix = prefix,
                    SecretAccessKeyId = SecretAccessKeyId,
                    UseSsl = UseSsl
                };

                task.Execute();
                Assert.IsTrue(task.Exists);
            }
        }
示例#2
0
        public void S3ExistsPrefixDoesNotExist()
        {
            if (!IsEmpty)
            {
                S3PrefixExists task = new S3PrefixExists()
                {
                    AccessKeyId = AccessKeyId,
                    BucketName = BucketName,
                    Prefix = Guid.NewGuid().ToString(),
                    SecretAccessKeyId = SecretAccessKeyId,
                    UseSsl = UseSsl
                };

                task.Execute();
                Assert.IsFalse(task.Exists);
            }
        }