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); }
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); }
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); }
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} 元"); }