コード例 #1
0
        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>();
        }
コード例 #2
0
        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>());
        }
コード例 #3
0
        public void GivenCreateBulkAsyncWhenExpectedExceptionIsThrownThenHandlesGracefully()
        {
            // Arrange

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

            // Assert
            exception.ShouldNotBeNull();
            exception.ShouldBeOfType <NotImplementedException>();
        }
コード例 #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());
            }
        }