Example #1
0
        public void CalculateFeeTest()
        {
            //arrange
            var target = new Blackcat();
            var product = new ShippingProduct
            {
                Name = "book",
                Weight = 10,
                Size = new Size
                {
                    Length = 30,
                    Width = 20,
                    Height = 10
                },
            };

            //act
            target.CalculateFee(product);

            //assert
            var expected = 200;
            Assert.AreEqual(expected, product.ShippingFee);
        }
Example #2
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;
    }