public void GivenALineDiscount_WhenIsApplicableOnNonLine_ThenShouldReturnFalse()
        {
            var sut = new LineDiscount("d", 1, 1, 1);
            var order = new Order(string.Empty);

            Assert.IsFalse(sut.IsApplicable(order));
        }
        public void GivenALineDiscount_WhenAppliedToNonLine_ThenShouldReturnZero()
        {
            var sut = new LineDiscount("d", 1, 1, 1);
            var order = new Order(string.Empty);

            Assert.AreEqual(0, sut.Apply(order));
        }
        public void GivenALineDiscount_WhenAppliedToLine_ThenShouldReturnLineTotalTimesPercentage()
        {
            var sut = new LineDiscount("d", 1, 1, 1);
            var line = new Line(new Bike(string.Empty, string.Empty, 100), 2);

            Assert.AreEqual(line.CalculateTotal() * sut.Percentage, sut.Apply(line));
        }
        public void GivenALineDiscount_WhenIsApplicableOnLine_ThenShouldReturnTrue()
        {
            const int PriceThreshold = 100;
            const int QuantityThreshold = 2;

            var sut = new LineDiscount("d", 1, QuantityThreshold, PriceThreshold);
            var line = new Line(new Bike(string.Empty, string.Empty, PriceThreshold), QuantityThreshold + 1);

            Assert.IsTrue(sut.IsApplicable(line));
        }
 public void GivenNullCode_WhenDiscountIsCreated_ThenExceptionIsThrown()
 {
     var sut = new LineDiscount(null, 0, 0, 0);
 }
 public void GivenInvalidQuantityThreshold_WhenLineDiscountIsCreated_ThenExceptionIsThrown()
 {
     var sut = new LineDiscount("d", 1, 0, 1);
 }
 public void GivenInvalidPercentage_WhenDiscountIsCreated_ThenExceptionIsThrown()
 {
     var sut = new LineDiscount("d", 0, 0, 0);
 }
 public void GivenEmptyCode_WhenDiscountIsCreated_ThenExceptionIsThrown()
 {
     var sut = new LineDiscount(string.Empty, 0, 0, 0);
 }