Ejemplo n.º 1
0
        public async Task Post_CreateBook_Success201()
        {
            // Arrange.
            var ctx        = new CatalogDbContext(_dbOptions);
            var controller = new BooksController(ctx);
            var t          = "201Title";
            var isbn       = "2123213";
            var numPages   = (short)600;
            var authorIds  = new int[] { 100, 200 };
            var inputVM    = new BookInputViewModel
            {
                Title = t, Isbn = isbn, NumberOfPages = numPages, AuthorsIds = authorIds
            };

            // Act.
            var result = await controller.CreateBookAsync(inputVM);

            // Assert.
            Assert.IsType <CreatedAtActionResult>(result);
        }