Esempio n. 1
0
        public void CalculateOrderCostTestWithoutSpeedyShippingTest()
        {
            //Arrange
            List <Parcel> parcels = new List <Parcel>();

            parcels.Add(new Parcel
            {
                Height = 6,
                Length = 7,
                Width  = 9
            });
            parcels.Add(new Parcel
            {
                Height = 10,
                Length = 30,
                Width  = 40
            });


            //Act
            var cost  = new DeliveryCostsCalculation();
            var order = cost.CalculateOrderCost(parcels);

            //Assert
            Assert.AreEqual(11, order.TotalCost);
        }
Esempio n. 2
0
        public void CalculateParcleBySizeTestForMediumParcel()
        {
            //Arrange
            var parcel = new Parcel()
            {
                Height = 10,
                Length = 30,
                Width  = 40
            };
            //Act
            var costCalculation = new DeliveryCostsCalculation();
            var targetParcel    = costCalculation.CalculateDeliveryCostByParcelSize(parcel);

            //Assert
            Assert.AreEqual(8, targetParcel.Cost);
        }
Esempio n. 3
0
        public void CalculateParcleBySizeTestForSmallParcel()
        {
            //Arrange
            var parcel = new Parcel()
            {
                Height = 6,
                Length = 7,
                Width  = 9
            };

            //Act
            var cost         = new DeliveryCostsCalculation();
            var targetParcel = cost.CalculateDeliveryCostByParcelSize(parcel);

            //Assert
            Assert.AreEqual(3, targetParcel.Cost);
        }
Esempio n. 4
0
        public void CalculateOverWeightParcelForSmallSize()
        {
            //Arrange
            List <Parcel> parcels = new List <Parcel>();

            parcels.Add(new Parcel
            {
                Height = 6,
                Length = 7,
                Width  = 9,
                Weight = 11
            });

            //Act
            var cost  = new DeliveryCostsCalculation();
            var order = cost.CalculateOrderCost(parcels, true);

            //Assert
            Assert.AreEqual(23, order.TotalCost);
        }