예제 #1
0
        public void WhenTheItemIsNotCoveredByPreviousPricingRulesVATShuldBeZero()
        {
            //Arrange
            var sut  = new ComplexPricingShoppingBasket();
            var item = new Item(new Product(10, "Newt"), 3);

            sut.Add(item);

            //Act
            var result = sut.CalculateTotal();

            //Assert
            Assert.That(result, Is.EqualTo(30m));
        }
예제 #2
0
        public void WhenItemNameBeginsWithTVATShouldBeFlatRateOfFour()
        {
            //Arrange
            var sut  = new ComplexPricingShoppingBasket();
            var item = new Item(new Product(10, "Tree Frog"), 3);

            sut.Add(item);

            //Act
            var result = sut.CalculateTotal();

            //Assert
            Assert.That(result, Is.EqualTo(42m));
        }
예제 #3
0
        public void WhenTheItemNameHasMoreThan5LettersVATShouldBeTwiceTheLetters()
        {
            //Arrange
            var sut  = new ComplexPricingShoppingBasket();
            var item = new Item(new Product(10, "Hippopotomonstrosesquipedaliophobia"), 3);

            sut.Add(item);

            //Act
            var result = sut.CalculateTotal();

            //Assert
            Assert.That(result, Is.EqualTo(100m));
        }
예제 #4
0
        public void WhenItemNameBeginsWithVowelVATShouldBeTwentyPercent(string productName)
        {
            //Arrange
            var sut  = new ComplexPricingShoppingBasket();
            var item = new Item(new Product(10, productName), 3);

            sut.Add(item);

            //Act
            var result = sut.CalculateTotal();

            //Assert
            Assert.That(result, Is.EqualTo(36m));
        }