예제 #1
0
        public void When_AddNewBook_Success()
        {
            //arrange
            var newBook = new CreateNewBookInput
            {
                Title      = "Asp.Net Core",
                Price      = 20,
                CategoryId = 1
            };

            _categoryRepo.GetById(newBook.CategoryId).Returns(CategoryMock.GetValidSingle());
            try
            {
                //act
                _bookBLL.AddNewBook(newBook);
                _bookRepo.Received().Insert(Arg.Any <Book>());
            }
            catch
            {
                //assert
                Assert.Fail();
            }
        }