コード例 #1
0
        private void AssertDiscountRate(int numberOfBooks, int expectedDiscountPercentage)
        {
            var rateCard = new DiscountRateCard();
            var discount = rateCard.CalculateDiscountRate(numberOfBooks);
            Assert.That(discount, Is.EqualTo(expectedDiscountPercentage));

            Debug.WriteLine("{0} books gives {1}% discount", numberOfBooks, expectedDiscountPercentage);
        }
コード例 #2
0
 public void PassingDiscountRateCardAnInvalidNumberOfBooksCausesException()
 {
     var rateCard = new DiscountRateCard();
     Assert.Throws<ArgumentException>(() => rateCard.CalculateDiscountRate(8));
 }
コード例 #3
0
 public void DiscountRateIsThePercentageOfTotalPriceToBePaid()
 {
     var rateCard = new DiscountRateCard();
     Assert.That(rateCard.CalculateRateToCharge(2), Is.EqualTo(0.95m));
 }