コード例 #1
0
        private static SelfCheckout EnterItem(SelfCheckout selfCheckout, int index)
        {
            var price = Input.Parse(message: string.Format("Price of item {0}: ", index));
            var quantity = Input.Parse(message: string.Format("Quantity of item {0}: ", index));

            return selfCheckout.Scan(price, quantity);
        }
コード例 #2
0
        private static SelfCheckout EnterItem(SelfCheckout selfCheckout, int index)
        {
            var price    = Input.Parse(message: string.Format("Price of item {0}: ", index));
            var quantity = Input.Parse(message: string.Format("Quantity of item {0}: ", index));

            return(selfCheckout.Scan(price, quantity));
        }
コード例 #3
0
        public void SubTotal_Of_One_Item_Scanned()
        {
            var subject = new SelfCheckout();

            decimal total = subject
                .Scan(price: 25, quantity: 1)
                .SubTotal();

            Assert.That(total, Is.EqualTo(25.00m));
        }
コード例 #4
0
        public void Tax_Of_One_Item_Scanned()
        {
            var subject = new SelfCheckout();

            decimal tax = subject
                          .Scan(price: 25, quantity: 1)
                          .Tax();

            Assert.That(tax, Is.EqualTo(1.375m));
        }
コード例 #5
0
        public void Total_Of_One_Item_Scanned()
        {
            var subject = new SelfCheckout();

            decimal total = subject
                            .Scan(price: 25, quantity: 1)
                            .Total();

            Assert.That(total, Is.EqualTo(26.375m));
        }
コード例 #6
0
        public void Tax_Of_One_Item_Scanned_With_Multiple_Quantities()
        {
            var subject = new SelfCheckout();

            decimal total = subject
                            .Scan(price: 25, quantity: 2)
                            .Tax();

            Assert.That(total, Is.EqualTo(2.75m));
        }
コード例 #7
0
        public void SubTotal_Of_Multiple_Items_Scanned_With_Multiple_Quantities()
        {
            var subject = new SelfCheckout();

            decimal total = subject
                            .Scan(price: 25, quantity: 2)
                            .Scan(price: 10, quantity: 1)
                            .SubTotal();

            Assert.That(total, Is.EqualTo(60m));
        }
コード例 #8
0
        public void Scanning_Multiple_Items()
        {
            var subject = new SelfCheckout();

            subject = subject
                      .Scan(price: 25, quantity: 2)
                      .Scan(price: 10, quantity: 1)
                      .Scan(price: 4, quantity: 1);

            Assert.That(subject.SubTotal(), Is.EqualTo(64.00m));
            Assert.That(subject.Tax(), Is.EqualTo(3.52m));
            Assert.That(subject.Total(), Is.EqualTo(67.52m));
        }
コード例 #9
0
        public void Tax_Of_One_Item_Scanned()
        {
            var subject = new SelfCheckout();

            decimal tax = subject
                .Scan(price: 25, quantity: 1)
                .Tax();

            Assert.That(tax, Is.EqualTo(1.375m));
        }
コード例 #10
0
        public void Scanning_Multiple_Items()
        {
            var subject = new SelfCheckout();

            subject = subject
                .Scan(price: 25, quantity: 2)
                .Scan(price: 10, quantity: 1)
                .Scan(price: 4, quantity: 1);

            Assert.That(subject.SubTotal(), Is.EqualTo(64.00m));
            Assert.That(subject.Tax(), Is.EqualTo(3.52m));
            Assert.That(subject.Total(), Is.EqualTo(67.52m));
        }
コード例 #11
0
        public void SubTotal_Of_Multiple_Items_Scanned_With_Multiple_Quantities()
        {
            var subject = new SelfCheckout();

            decimal total = subject
                .Scan(price: 25, quantity: 2)
                .Scan(price: 10, quantity: 1)
                .SubTotal();

            Assert.That(total, Is.EqualTo(60m));
        }
コード例 #12
0
        public void Tax_Of_One_Item_Scanned_With_Multiple_Quantities()
        {
            var subject = new SelfCheckout();

            decimal total = subject
                .Scan(price: 25, quantity: 2)
                .Tax();

            Assert.That(total, Is.EqualTo(2.75m));
        }