public void AddNewBookReturnAddedBook()
        {
            //Arrange
            var adapter = PrepareTypeAdapter();
            var customerRepository = new SICustomerRepository();
            var orderRepository = new SIOrderRepository();
            var productRepository = new SIProductRepository();

            productRepository.UnitOfWorkGet = () =>
            {
                var uow = new SIUnitOfWork();
                uow.Commit = () => { };

                return uow;
            };

            productRepository.AddProduct = (product) => { };

            var salesManagement = new SalesAppService(adapter, productRepository, orderRepository,customerRepository);

            var dto = new BookDTO()
            {
                Title = "The title",
                Description = "description",
                Publisher = "license",
                ISBN = "isbn",
                AmountInStock = 10,
                UnitPrice = 10
            };

            //Act
            var result = salesManagement.AddNewBook(dto);

            //Assert
            Assert.IsNotNull(result);
            Assert.IsTrue(result.Id != Guid.Empty);
            Assert.AreEqual(result.Title, dto.Title);
            Assert.AreEqual(result.Description, dto.Description);
            Assert.AreEqual(result.Publisher, dto.Publisher);
            Assert.AreEqual(result.ISBN, dto.ISBN);
            Assert.AreEqual(result.AmountInStock, dto.AmountInStock);
            Assert.AreEqual(result.UnitPrice, dto.UnitPrice);
        }
      public void AddNewBookThrowExceptionWhenDataIsInvalid()
      {
         //Arrange 

         var customerRepository = new StubICustomerRepository();
         var productRepository = new StubIProductRepository();
         var orderRepository = new StubIOrderRepository();

         var salesManagement = new SalesAppService(productRepository, orderRepository, customerRepository);

         var dto = new BookDto()
         {
            Title = "The title",
            Description = "description",
            Publisher = "license",
            Isbn = "isbn",
            AmountInStock = 10,
            UnitPrice = -1 //this is a not valid value
         };

         //Act
         var result = salesManagement.AddNewBook(dto);

      }
      public void AddNewBookWithNullDataThrowArgumentException()
      {
         //Arrange 
         var customerRepository = new StubICustomerRepository();
         var productRepository = new StubIProductRepository();
         var orderRepository = new StubIOrderRepository();

         var salesManagement = new SalesAppService(productRepository, orderRepository, customerRepository);

         //Act

         var result = salesManagement.AddNewBook(null);

         //Assert
         Assert.IsNull(result);
      }
        public void AddNewBookWithNullDataReturnNull()
        {
            //Arrange
            var adapter = PrepareTypeAdapter();
            var customerRepository = new SICustomerRepository();
            var productRepository = new SIProductRepository();
            var orderRepository = new SIOrderRepository();

            var salesManagement = new SalesAppService(adapter, productRepository, orderRepository,customerRepository);

            //Act

            var result = salesManagement.AddNewBook(null);

            //Assert
            Assert.IsNull(result);
        }