Ejemplo n.º 1
0
        public void GivenCreateBulkAsyncWhenExpectedExceptionIsThrownThenHandlesGracefully()
        {
            // Arrange

            // Act
            var exception = Assert.ThrowsAsync <NotImplementedException>(
                () => subscriptionService.CreateBulkAsync(It.IsAny <IEnumerable <Subscription> >()));

            // Assert
            exception.Should().NotBeNull().And.BeOfType <NotImplementedException>();
        }
Ejemplo n.º 2
0
        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>());
        }
Ejemplo n.º 3
0
        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());
            }
        }