Exemplo n.º 1
0
        public void hsinchu_with_huge_size()
        {
            var shipper = ShipperStrategyFactory.CreateInstance(ShipperType.Hsinchu);
            var product = new Product {
                Length = 100, Width = 20, Height = 10, Weight = 50
            };
            var actual = shipper.ShippingFee(product);

            Assert.AreEqual(480, actual);
        }
Exemplo n.º 2
0
        public void post_office_by_size()
        {
            var shipper = ShipperStrategyFactory.CreateInstance(ShipperType.PostOffice);
            var product = new Product {
                Length = 100, Width = 20, Height = 10, Weight = 300
            };
            var actual = shipper.ShippingFee(product);

            Assert.AreEqual(440, actual);
        }
Exemplo n.º 3
0
        public void black_cat_with_heavy_weight()
        {
            var shipper = ShipperStrategyFactory.CreateInstance(ShipperType.BlackCat);
            var product = new Product {
                Length = 30, Width = 20, Height = 10, Weight = 50
            };
            var actual = shipper.ShippingFee(product);

            Assert.AreEqual(500, actual);
        }
Exemplo n.º 4
0
        private static void Main(string[] args)
        {
            var product = new Product {
                Length = 30, Width = 20, Height = 10, Weight = 5
            };

            var shipper = ShipperStrategyFactory.CreateInstance(ShipperType.BlackCat);
            var fee     = shipper.ShippingFee(product);

            Console.WriteLine($"運算為 {fee} 元");
        }