internal async Task GivenCreateBulkAsyncWhenExpectedExceptionIsThrownThenHandlesGracefully()
        {
            // Arrange

            // Act
            var exception = await Assert.ThrowsAsync <NotImplementedException>(
                () => videoService.CreateBulkAsync(It.IsAny <IEnumerable <Video> >()));

            // Assert
            exception.Should().NotBeNull().And.BeOfType <NotImplementedException>();
        }
        public void GivenCreateBulkAsyncWhenExpectedExceptionIsThrownThenHandlesGracefully()
        {
            // Arrange

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

            // Assert
            Assert.That(exception, Is.Not.Null);
            Assert.That(exception, Is.TypeOf <NotImplementedException>());
        }
Esempio n. 3
0
        public void GivenCreateBulkAsyncWhenExpectedExceptionIsThrownThenHandlesGracefully()
        {
            // Arrange

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

            // Assert
            exception.ShouldNotBeNull();
            exception.ShouldBeOfType <NotImplementedException>();
        }
Esempio n. 4
0
        public async Task <IActionResult> CreateBulkAsync([FromBody] ICollection <Video> videos)
        {
            try
            {
                await videoService.CreateBulkAsync(videos);

                return(Created("api/v1/videos", videos));
            }
            catch
            {
                return(BadRequest());
            }
        }