public void Calling_method_AddBucketAsync_with_null_as_bucket_parameter_should_fail(Exception exception = null) { $"When method AddBucketAsync method will be called with parameter bucket == null" .x(async() => exception = await Record.ExceptionAsync(async() => await _storage.AddBucketAsync(null))); $"Then an ArgumentNullException is thrown" .x(() => Assert.IsType <ArgumentNullException>(exception)); }
public async Task <IActionResult> Put(string bucket, CancellationToken cancellationToken) { var newBucket = new Bucket { Id = bucket, CreationDate = DateTime.UtcNow }; await _storage.AddBucketAsync(newBucket, cancellationToken); return(Ok()); }
public void Background() { "Given a new ServiceFabricStorage instance" .x(() => { _stateManager = new MockReliableStateManager(); var optionsMock = new Mock <IOptionsSnapshot <ServiceFabricStorageOptions> >(); optionsMock.Setup(m => m.Value).Returns(new ServiceFabricStorageOptions { DefaultTimeoutFromSeconds = 10 }); _storage = new S3.Storage.ServiceFabricStorage(_stateManager, optionsMock.Object); }); $"And a saved Bucket named {BucketId}" .x(async() => { await _storage.AddBucketAsync(new Bucket { CreationDate = DateTime.UtcNow, Id = BucketId }); }); }
public async Task RunAsync(CancellationToken cancellationToken) { await _s3Storage.AddBucketAsync(new Bucket { Id = "vaultbucket", CreationDate = DateTime.UtcNow }, cancellationToken); if (!await StartProcess(cancellationToken)) { var process = _process; if (process != null) { _logger.LogError("Start of {FileName} has been failed! (Exit code: {ExitCode})", _fileName, process.ExitCode); } else { _logger.LogError("Start of {FileName} has been failed!", _fileName); } await StopProcess(cancellationToken); throw new InvalidProgramException($"Start of {_fileName} has been failed!"); } }