Esempio n. 1
0
    private IShipper GetShipper(string shipperId)
    {
        IShipper result = null;
        switch (shipperId)
        {
            case "1":
                result = new Blackcat();
                break;

            case "2":
                result = new HsinChu();
                break;

            case "3":
                result = new Postoffice();
                break;

            default:
                break;
        }

        return result;
    }
Esempio n. 2
0
        public void CalculateFeeTest()
        {
            //arrange
            var target = new HsinChu();
            var product = new ShippingProduct
            {
                Name = "book",
                Weight = 10,
                Size = new Size
                {
                    Length = 30,
                    Width = 20,
                    Height = 10
                },
            };

            //act
            target.CalculateFee(product);

            //assert
            var expected = 254.16;
            Assert.AreEqual(expected, product.ShippingFee);
        }