예제 #1
0
 public void Scan(IScannable basket)
 {
     for (var item = basket.TakeItem(); item != null; item = basket.TakeItem())
     {
         ScanItem(item);
     }
 }
        public void The_total_is_the_total_price_of_multiple_scanned_items()
        {
            var unit = new Checkout(_itemCatalogue, _discounts);

            _basket.TakeItem().Returns(_item1, _item2, null);
            _itemCatalogue.LookupPrice(_item1).Returns(_item1Price);
            _itemCatalogue.LookupPrice(_item2).Returns(_item2Price);
            _discounts.GetApplicable(Arg.Any <Collection <IPurchaseable> >()).Returns(new Discount(0));

            unit.Scan(_basket);

            var expected = _item1Price.AsCurrency() + _item2Price.AsCurrency();

            Assert.That(unit.GetTotal().AsCurrency(), Is.EqualTo(expected));
        }