public void GivenCreateBulkAsyncWhenExpectedExceptionIsThrownThenHandlesGracefully() { // Arrange // Act var exception = Assert.ThrowsAsync <NotImplementedException>( () => subscriptionService.CreateBulkAsync(It.IsAny <IEnumerable <Subscription> >())); // Assert exception.Should().NotBeNull().And.BeOfType <NotImplementedException>(); }
public void GivenCreateBulkAsyncWhenExpectedExceptionIsThrownThenHandlesGracefully() { // Arrange // Act var exception = Assert.ThrowsAsync <NotImplementedException>( () => subscriptionService.CreateBulkAsync(It.IsAny <IEnumerable <Subscription> >())); // Assert Assert.That(exception, Is.Not.Null); Assert.That(exception, Is.TypeOf <NotImplementedException>()); }
internal async Task GivenCreateBulkAsyncWhenExpectedExceptionIsThrownThenHandlesGracefully() { // Arrange // Act var exception = await Assert.ThrowsAsync <NotImplementedException>( () => subscriptionService.CreateBulkAsync(It.IsAny <IEnumerable <Subscription> >())); // Assert Assert.NotNull(exception); Assert.IsType <NotImplementedException>(exception); }
public async Task <IActionResult> CreateBulkAsync([FromBody] ICollection <Subscription> subscriptions) { try { await subscriptionService.CreateBulkAsync(subscriptions); return(Created("api/v1/subscriptions", subscriptions)); } catch { return(BadRequest()); } }