예제 #1
0
        private static void PopulateBasket(IBasket basket)
        {
            Item item1 = new SportItem(15, "Football", 1, SportItemKind.X);

            basket.Add(item1);

            Item item2 = new SportItem(10, "Baseball", 1, SportItemKind.Y);

            basket.Add(item2);
        }
예제 #2
0
        public void AddItem_GivenItemA_BaksetCountShouldBe1()
        {
            //Arrange
            var expected = 1;
            var item     = new BasketItem("A");

            //Act
            basket.Add(item);

            //Assert
            var total = basket.Total;

            Assert.That(total, Is.EqualTo(expected));
        }
예제 #3
0
 public void GivenIHaveAddedNInstancesOfAnItemToTheBasket(int number, string item)
 {
     for (var i = 0; i < number; i++)
     {
         _basket.Add(item);
     }
 }
        public void AddProductToBasketAndShowBasketPage()
        {
            Product product = _productService.GetProductBy(_view.ProductId);

            _basket.Add(product);

            _pageNavigator.NaviagteTo(PageDirectory.Basket);
        }
예제 #5
0
 public IActionResult Create(Basket basket)
 {
     if (ModelState.IsValid)
     {
         _context.Add(basket);
         return(RedirectToAction("Index"));
     }
     return(View(basket));
 }
예제 #6
0
 public HttpResponseMessage Add(string username, ShoppingCartItem item)
 {
     try
     {
         item.Customer = username;
         _basket.Add(item);
         return(new HttpResponseMessage(HttpStatusCode.OK));
     }
     catch (Exception e)
     {
         return(new HttpResponseMessage(HttpStatusCode.BadRequest));
     }
 }
예제 #7
0
        public void AddItemTest()
        {
            _basket.Add(_products[0], 100);

            Assert.Equal(1, _basket.Items.Count());
        }