예제 #1
0
        public void Buy_SingleBook_CatalogPrice()
        {
            double price = _store.Buy(
                "Robin Hobb - Assassin Apprentice");

            Assert.AreEqual(12, price);
        }
예제 #2
0
        public void When_client_buy_on_book_he_pays_at_the_price()
        {
            // ARRANGE
            double expectedPrice = 24.0;
            // ACT
            double price = store.Buy("J.K Rowling - Goblet Of fire", "Isaac Asimov - Foundation");

            // ASSERT
            Assert.AreEqual(expectedPrice, price);
        }
예제 #3
0
 public void Update(IStore sender, CustomerNotificationArgs args)
 {
     if (args.Item.Type == Interest)
     {
         if (args.Item.Price <= Budget)
         {
             Budget -= args.Item.Price;
             sender.Buy(this, args.Item);
         }
     }
 }
예제 #4
0
 public IActionResult GetPrice([FromBody] BooksVM bookNames)
 {
     try
     {
         double price = _librairieService.Buy(bookNames.BookNames);
         return(Ok(price));
     }
     catch (NotEnoughInventoryException ex)
     {
         return(BadRequest(ex.Missing.ToList()));
     }
 }
예제 #5
0
        public ActionResult Buy([FromBody] params string[] basketNames)
        {
            try
            {
                double basketPrice = _storeService.Buy(basketNames);

                return(Ok(basketPrice));
            }
            catch (NotEnoughInventoryException nex)
            {
                return(BadRequest(new { Exception = nex.Message, Books = nex.Missing }));
            }
        }
예제 #6
0
 public double BooksPrice(string[] booksNames)
 {
     return(_storeRepo.Buy(booksNames));
 }