private AmazonS3CabinetConfig GetConfig(string bucketName, string keyPrefix = null) { var config = new AmazonS3CabinetConfig(bucketName, RegionEndpoint.APSoutheast2, null) { KeyPrefix = keyPrefix }; return(config); }
public async Task Save_File_Stream_Null_Config_Throws() { var provider = GetProvider(); AmazonS3CabinetConfig config = null; var mockStream = new Mock <Stream>(); var mockProgress = new Mock <IProgress <IWriteProgress> >(); await Assert.ThrowsAsync <ArgumentNullException>(async() => await provider.SaveFileAsync(ValidFileKey, mockStream.Object, HandleExistingMethod.Overwrite, mockProgress.Object, config) ); }
public async Task Save_File_Path_Config_Throws() { var provider = GetProvider(); AmazonS3CabinetConfig config = null; string filePath = @"C:\test\test.txt"; var mockProgress = new Mock <IProgress <IWriteProgress> >(); await Assert.ThrowsAsync <ArgumentNullException>(async() => await provider.SaveFileAsync(ValidFileKey, filePath, HandleExistingMethod.Overwrite, mockProgress.Object, config) ); }
public async Task Move_File_Path_Null_Config_Throws() { var provider = GetProvider(); AmazonS3CabinetConfig config = null; string sourceKey = @"source.txt"; string destKey = @"dest.txt"; var mockProgress = new Mock <IProgress <IWriteProgress> >(); await Assert.ThrowsAsync <ArgumentNullException>(async() => await provider.MoveFileAsync(sourceKey, destKey, HandleExistingMethod.Overwrite, config) ); }
public void Get_S3_Client_Sets_Credentails_And_Config() { var s3Config = new AmazonS3Config() { RegionEndpoint = Amazon.RegionEndpoint.USEast1, }; var mockCredentials = new Mock <AWSCredentials>(); var config = new AmazonS3CabinetConfig(ValidBucketName, s3Config, mockCredentials.Object); var client = factory.GetS3Client(config) as AmazonS3Client; Assert.NotNull(client); Assert.Equal(s3Config, client.Config); }
public void Get_Set_Bucket_Name() { var config = new AmazonS3CabinetConfig(ValidBucketName, mockS3Config.Object, mockS3Credentials.Object); Assert.Equal(ValidBucketName, config.BucketName); }
public async Task List_Keys_Null_Config_Throws() { var provider = GetProvider(); AmazonS3CabinetConfig config = null; await Assert.ThrowsAsync <ArgumentNullException>(async() => await provider.ListKeysAsync(config)); }
public async Task Delete_File_Null_Config_Throws() { var provider = GetProvider(); AmazonS3CabinetConfig config = null; await Assert.ThrowsAsync <ArgumentNullException>(async() => await provider.DeleteFileAsync(ValidFileKey, config)); }
public async Task Open_Read_Stream_Null_Config_Throws() { var provider = GetProvider(); AmazonS3CabinetConfig config = null; await Assert.ThrowsAsync <ArgumentNullException>(async() => await provider.OpenReadStreamAsync(ValidFileKey, config)); }