Пример #1
0
        public void When_AddNewBook_NotValidCategory_Then_ReturnException()
        {
            var categoryNull = CategoryMock.GetNull();

            _categoryRepo.GetById(0).Returns(categoryNull);
            try
            {
                _bookBLL.AddNewBook(BookMock.GetInputWithNotValidCategoryMock());
                Assert.Fail();
            }
            catch (Exception ex)
            {
                Assert.IsInstanceOfType(ex, typeof(BLLException));
                Assert.AreEqual(ExceptionCodes.BLLExceptions.CategoryNotFound.ToString(), ((BLLException)ex).Code);
                throw ex;
            }
        }