public async Task When_GettingNonExistingBucket_Expect_BucketNotFoundException() { // Arrange GetBucket.Query query = new GetBucket.Query(new Random().Next(int.MaxValue)); GetBucket.Handler handler = new GetBucket.Handler(this.repository); // Act Exception exception = await Record.ExceptionAsync(() => handler.Handle(query, default)); // Assert Assert.IsType <BucketNotFoundException>(exception); }
public async Task When_GettingBucket_Expect_ExistingBucket() { // Arrange Bucket bucket = new Bucket(); await this.repository.AddAsync(bucket); GetBucket.Query query = new GetBucket.Query(bucket.Id); GetBucket.Handler handler = new GetBucket.Handler(this.repository); // Act GetBucket.Response response = await handler.Handle(query, default); // Assert Assert.Equal(bucket.Id, response.Bucket.Id); Assert.Equal(bucket.Name, response.Bucket.Name); }