public void AddBookType(string title, string authors, decimal price, int quantity, Category category, string imageURL)
        {
            QuantityMap quantityMap = new QuantityMap()
            {
                Quantity = quantity
            };

            BookImage image = new BookImage()
            {
                URL = imageURL
            };

            BookType newBookType = new BookType()
            {
                Title = title,
                Authors = authors,
                Price = price,
                QuantityMap = quantityMap,
                Category = category,
                Image = image
            };

            StorehouseManagementDao.SaveBookType(newBookType);
        }
        public void Initialize()
        {
            TEST_QUANTITY = 5;
            TEST_ADD_QUANTITY = 4;
            TEST_CAT_NAME = "testowa kategoria";
            testCategory = new Category();
            testCategory.Name = TEST_CAT_NAME;
            testBook = new BookType();
            testGetBook = new BookType();
            testBook.Id = 47123;
            testBook.Title = "Książka testowa";
            testBook.Authors = "Autor testowy";
            testBook.Category = testCategory;
            testBook.QuantityMap = new QuantityMap();
            testBook.QuantityMap.Quantity = TEST_QUANTITY;
            testBook.Price = 40;

            categoryList = new List<Category>();
            bookTypeList = new List<BookType>();

             booksInformationDaoMock = _factory.CreateMock<IBooksInformationDao>();
             bis.BooksInformationDao = booksInformationDaoMock.MockObject;
             sms.BooksInformationDao = booksInformationDaoMock.MockObject;

             booksInformationDaoMock.Expects.One.MethodWith<IEnumerable<BookType>>(x => x.GetAllBooks()).WillReturn(bookTypeList);
             booksInformationDaoMock.Expects.One.MethodWith<IList<Category>>(x => x.GetAllCategories()).WillReturn(categoryList);
             booksInformationDaoMock.Expects.One.MethodWith<BookType>(x => x.GetBookTypeById(testBook.Id)).WillReturn(testBook);
             booksInformationDaoMock.Expects.One.MethodWith<BookType>(x => x.GetBookTypeById(testGetBook.Id)).WillReturn(testGetBook);

            storehouseManagementDaoMock = _factory.CreateMock<IStorehouseManagementDao>();
            sms.StorehouseManagementDao = storehouseManagementDaoMock.MockObject;

            NMock.Actions.InvokeAction markSold = new NMock.Actions.InvokeAction(new Action(() => changeQuantity()));
            storehouseManagementDaoMock.Expects.Any.MethodWith(x => x.MarkSold(testBook.Id, testBook.QuantityMap.Quantity)).Will(markSold);
            storehouseManagementDaoMock.Expects.One.MethodWith<bool>(x => x.MarkSold(-1, 5)).WillReturn(false);

            NMock.Actions.InvokeAction saveCategory = new NMock.Actions.InvokeAction(new Action(() => categoryList.Add(testCategory)));
            storehouseManagementDaoMock.Expects.Any.MethodWith(x => x.SaveCategory(testCategory)).Will(saveCategory);
            NMock.Actions.InvokeAction saveBookType = new NMock.Actions.InvokeAction(new Action(() => bookTypeList.Add(testBook)));
            storehouseManagementDaoMock.Expects.Any.MethodWith(x => x.SaveBookType(testBook)).Will(saveBookType);
            NMock.Actions.InvokeAction addCategory = new NMock.Actions.InvokeAction(new Action(() => categoryList.Add(testCategory)));
            storehouseManagementDaoMock.Expects.Any.MethodWith(x => x.AddCategory(TEST_CAT_NAME)).Will(addCategory);
            NMock.Actions.InvokeAction addBookType = new NMock.Actions.InvokeAction(new Action(() => bookTypeList.Add(testBook)));
            storehouseManagementDaoMock.Expects.Any.MethodWith(x => x.AddBookType(testBook.Title, testBook.Authors, testBook.Price, TEST_QUANTITY, testBook.Category)).Will(addBookType);
               // NMock.Actions.InvokeAction addQuantity = new NMock.Actions.InvokeAction(new Action(() =>

            quantityMap = new QuantityMap()
            {
                Quantity = 0
            };

            image = new BookImage()
            {
                URL = ""
            };
            category = new Category()
            {

            };
        }