Example #1
0
        public async Task ThrowNotSupportedException(IamAuthenticationType iamAuthenticationType)
        {
            // Arrange
            var bucketObject = new BucketObject(BucketObjectKey.WithoutPrefix);

            // Act
            var actual = HttpClient.PostAsync(
                $"{Context.S3BucketUrl}/{bucketObject.Key}",
                bucketObject.StringContent,
                Context.RegionName,
                Context.ServiceName,
                ResolveMutableCredentials(iamAuthenticationType));

            // Assert
            await actual.ShouldThrowAsync <NotSupportedException>();
        }
        public async Task SucceedGivenSafeCharacters(IamAuthenticationType iamAuthenticationType, string key)
        {
            // Arrange
            var bucketObject = new BucketObject(key);

            // Act
            var response = await HttpClient.PutAsync(
                $"{Context.S3BucketUrl}/{bucketObject.Key}",
                bucketObject.StringContent,
                Context.RegionName,
                Context.ServiceName,
                ResolveCredentials(iamAuthenticationType));

            // Assert
            response.StatusCode.ShouldBe(HttpStatusCode.OK);
        }
        public async Task SucceedGivenMultiLevelPrefix(IamAuthenticationType iamAuthenticationType)
        {
            // Arrange
            var bucketObject = new BucketObject(BucketObjectKey.WithMultiLevelPrefix);

            // Act
            var response = await HttpClient.PutAsync(
                $"{Context.S3BucketUrl}/{bucketObject.Key}",
                bucketObject.StringContent,
                Context.RegionName,
                Context.ServiceName,
                ResolveCredentials(iamAuthenticationType));

            // Assert
            response.StatusCode.ShouldBe(HttpStatusCode.OK);
        }
        public async Task SucceedGivenCharactersThatRequireSpecialHandling(IamAuthenticationType iamAuthenticationType)
        {
            // Arrange
            var bucketObject = new BucketObject(BucketObjectKey.WithCharactersThatRequireSpecialHandling);

            // Act
            var response = await HttpClient.PutAsync(
                $"{Context.S3BucketUrl}/{bucketObject.Key}",
                bucketObject.StringContent,
                Context.RegionName,
                Context.ServiceName,
                ResolveCredentials(iamAuthenticationType));

            // Assert
            response.StatusCode.ShouldBe(HttpStatusCode.OK);
        }
        public void AbortGivenCanceled(IamAuthenticationType iamAuthenticationType)
        {
            // Arrange
            var bucketObject = new BucketObject(BucketObjectKey.WithoutPrefix);
            var ct           = new CancellationToken(true);

            // Act
            var task = HttpClient.PutAsync(
                $"{Context.S3BucketUrl}/{bucketObject.Key}",
                bucketObject.StringContent,
                ct,
                Context.RegionName,
                Context.ServiceName,
                ResolveCredentials(iamAuthenticationType));

            // Assert
            task.Status.ShouldBe(TaskStatus.Canceled);
        }