Beispiel #1
0
        public void ShouldChangeQuantityOfItemInBasketGivenExistingItemDetail()
        {
            //arrange

            var customerId = 123456789;
            var itemDetail = new
            {
                ProductId = 1234,
                Quantity  = 1
            };
            var newQuantity = 25;

            var sut = new CustomerBasket(customerId);

            sut.AddItem(itemDetail.ProductId, itemDetail.Quantity);

            //act
            sut.ChangeQuantity(itemDetail.ProductId, newQuantity);

            //assert
            var result = sut.Items.Single();

            Assert.Equal(itemDetail.ProductId, result.ProductId);
            Assert.Equal(newQuantity, result.Quantity.Amount);
        }