コード例 #1
0
        public void Scan_ThreeASkus_TotalIs130()
        {
            var calculator = new Calculator();
            var checkout   = new CheckOut(this, calculator);

            _productPriceToReturn = 50;
            checkout.Scan("A");
            checkout.Scan("A");
            checkout.Scan("A");

            Assert.AreEqual(130, calculator.Total());
        }
コード例 #2
0
        public void ScanTwoItems_TotalIs80()
        {
            var calculator = new Calculator();
            var checkout   = new CheckOut(this, calculator);

            _productPriceToReturn = 50;
            checkout.Scan("A");
            _productPriceToReturn = 30;
            checkout.Scan("B");

            Assert.That(calculator.Total(), Is.EqualTo(80));
        }
コード例 #3
0
        public void ScanMultipleDiscountedItems()
        {
            var calculator = new Calculator();
            var checkout   = new CheckOut(this, calculator);

            _productPriceToReturn = 50;
            checkout.Scan("A");
            checkout.Scan("A");
            checkout.Scan("A");
            checkout.Scan("A");

            Assert.AreEqual(180, calculator.Total());
        }