public ParcelCostingParameters(
     ParcelCostingType costingType,
     decimal baseCost,
     decimal maxWeight,
     decimal costPerExtraKg,
     decimal?dimensionsMax = null)
 {
     CostingType    = costingType;
     BaseCost       = baseCost;
     MaxWeight      = maxWeight;
     CostPerExtraKg = costPerExtraKg;
     DimensionsMax  = dimensionsMax;
 }
 public ParcelDiscountParameters(ParcelCostingType costingType, Func <ParcelCosting, bool> selector, int count)
 {
     CostingType = costingType;
     Selector    = selector;
     Count       = count;
 }
Esempio n. 3
0
 Expression <Func <IParcelCosting, bool> > CheckParcel(decimal cost, ParcelCostingType parcelType)
 => p => p.CostingType == parcelType && p.ParcelCost == cost;
Esempio n. 4
0
        public void CalculateCosts_ForOrderWithSizedParcel_ShouldBeAmountAndType(decimal dimension, decimal cost, ParcelCostingType parcelType)
        {
            _order.SetupGet(o => o.Parcels).Returns(new[] { MakeParcel(dimension, 1).Object });

            var result = _calculator.CalculateCosts(_order.Object);

            result.TotalCost.Should().Be(cost);
            result.ParcelCosts.Should().ContainSingle()
            .And.Contain(CheckParcel(cost, parcelType));
        }
Esempio n. 5
0
        public void CalculateCosts_ForSpeedyOrderWithWeightedParcel_ShouldBeAmountAndType(decimal dimension, decimal weight, decimal cost, ParcelCostingType parcelType)
        {
            _order.SetupGet(o => o.SpeedyShipping).Returns(true);
            _order.SetupGet(o => o.Parcels).Returns(new[] { MakeParcel(dimension, weight).Object });

            var result = _calculator.CalculateCosts(_order.Object);

            result.TotalCost.Should().Be(cost * 2);
            result.ParcelCosts.Should().HaveCount(2)
            .And.Contain(CheckParcel(cost, parcelType))
            .And.Contain(CheckParcel(cost, ParcelCostingType.SpeedyShipping));
        }