private static async Task TestCredentials(ProxyRefreshingAWSCredentials creds, bool expectFailure) { using (var client = new AmazonS3Client(creds)) { try { await client.ListBucketsAsync(); Assert.False(expectFailure); } catch (AmazonClientException ace) { Assert.True(expectFailure); Assert.NotNull(ace); Assert.NotNull(ace.Message); Assert.True(ace.Message.IndexOf("already") >= 0); } } }