public void TestVersion01(string hostingPlan) { HostingPlanAbstractFactory hostingFactory = HostingPlanAbstractFactory.GetHostingFactory(hostingPlan); EconomyHostingPlan economyHostingPlan = hostingFactory.CreateEconomyHosting(); Debug.WriteLine(economyHostingPlan.GetFeatures()); DeluxeHostingPlan deluxeHostingPlan = hostingFactory.CreateDeluxeHosting(); Debug.WriteLine(deluxeHostingPlan.GetFeatures()); UltimateHostingPlan ultimateHostingPlan = hostingFactory.CreateUltimateHosting(); Debug.WriteLine(ultimateHostingPlan.GetFeatures()); }
static void Main(string[] args) { initialize(); String hostingPlan = Environment.GetEnvironmentVariable("HostingOS"); HostingPlanAbstractFactory hostingFactory = HostingPlanAbstractFactory.GetHostingFactory(hostingPlan); EconomyHostingPlan economyHostingPlan = hostingFactory.CreateEconomyHosting(); Console.WriteLine(economyHostingPlan.GetFeatures()); DeluxeHostingPlan deluxeHostingPlan = hostingFactory.CreateDeluxeHosting(); Console.WriteLine(deluxeHostingPlan.GetFeatures()); UltimateHostingPlan ultimateHostingPlan = hostingFactory.CreateUltimateHosting(); Console.WriteLine(ultimateHostingPlan.GetFeatures()); Console.ReadKey(); }