コード例 #1
0
        public void VisitVatReturnsCorrectResult(
            int initialTotal
            , int vatAmount)
        {
            var sut    = new BasketTotalVisitor(initialTotal);
            var actual = sut.Visit(new Vat(vatAmount));

            var btv = Assert.IsAssignableFrom <BasketTotalVisitor>(actual);

            Assert.Equal(initialTotal + vatAmount, btv.Total);
        }
コード例 #2
0
        public void VisitDiscountReturnsCorrectResult(
            int initialTotal,
            int discount)
        {
            var sut = new BasketTotalVisitor(initialTotal);

            var actual = sut.Visit(new Discount(discount));

            var btv = Assert.IsAssignableFrom <BasketTotalVisitor>(actual);

            Assert.Equal(initialTotal - discount, btv.Total);
        }
コード例 #3
0
        public void VisitBasketTotalElementReturnsCorrectResult(
            int expected,
            int total)
        {
            var sut = new BasketTotalVisitor(expected);

            var actual = sut.Visit(new BasketTotal(total));

            var btv = Assert.IsAssignableFrom <BasketTotalVisitor>(actual);

            Assert.Equal(expected, btv.Total);
        }
コード例 #4
0
        public void VisitProductBasketElementReturnsCorrectResult(
            int unitPrice,
            int quantity,
            int initialTotal)
        {
            var sut = new BasketTotalVisitor(initialTotal);

            var productElement =
                new BasketItem("Dummy name", unitPrice, quantity);
            var actual = sut.Visit(productElement);

            var btv = Assert.IsAssignableFrom <BasketTotalVisitor>(actual);

            Assert.Equal(productElement.Total + initialTotal, btv.Total);
        }