public async Task <ActionResult> AddBucket([FromBody] Bucket bucket) { AddBucket.Command command = new AddBucket.Command( name: bucket.Name, description: bucket.Description, size: bucket.Size); AddBucket.Response response = await this.mediator.Send(command); bucket = this.mapper.Map <Bucket>(response.Bucket); return(this.CreatedAtRoute("GetBucket", new { bucketId = bucket.Id }, bucket)); }
public async Task When_AddingBucket_Expect_AddedBucket() { // Arrange AddBucket.Command command = new AddBucket.Command( name: Guid.NewGuid().ToString(), description: null, size: null); AddBucket.Handler handler = new AddBucket.Handler(this.repository); // Act AddBucket.Response response = await handler.Handle(command, default); // Assert Assert.NotEqual(default, response.Bucket.Id);