Example #1
0
        public void ShoudReturnZeroCost_WhenThereIsNoExcessWeight(decimal cost, ParcelSize key, double weight)
        {
            //Arrange
            //The test values are defined on the attribute "InlineDate"

            var testCost = WeightLimit.GetCost(key, weight);

            Assert.Equal(cost, testCost);
        }
Example #2
0
        public void ShoudReturnTheCostOfTheExcessWeight(decimal cost, ParcelSize key, double weight)
        {
            //Arrange
            //The test values are defined on the attribute "InlineDate"

            //Act
            var testCost = WeightLimit.GetCost(key, weight);

            //Assert
            Assert.Equal(cost, testCost);
        }
Example #3
0
        public void ShouldCreateAParcelOrderAndSetTheTotalCostWithExtraWeight()
        {
            var length     = 1;
            var width      = 1;
            var heigth     = 1;
            var weight     = 6;
            var testParcel = new Parcel(length, width, heigth, weight);

            var testParcelOrder = new ParcelOrder(testParcel);

            var expectedTotalCost = SizeCost.GetCost(ParcelSize.Small) + WeightLimit.GetCost(ParcelSize.Small, weight);

            Assert.Single(testParcelOrder.Parcels);
            Assert.Equal(expectedTotalCost, testParcelOrder.TotalCost);
            Assert.All(testParcelOrder.Parcels, x =>
            {
                Assert.Equal(expectedTotalCost, x.Cost);
            });
            Assert.Null(testParcelOrder.SpeedyShippingCost);
        }