public static void Main() { VenueFactory venueFactory = VenueFactory.GetInstance; venueFactory.Register(VenueAddOns.AFTERNOON_REFRESHMENTS, new VenueAfternoonRefreshments()); venueFactory.Register(VenueAddOns.BUS_TRANSPORTS, new VenueBusTransport()); venueFactory.Register(VenueAddOns.EVENING_MEAL, new VenueEveningMeal()); venueFactory.Register(VenueAddOns.MIDDAY_LUNCH, new VenueMiddayLunch()); venueFactory.Register(VenueAddOns.MORNING_REFRESHMENTS, new VenueMorningRefreshments()); ActivityFactory activityFactory = ActivityFactory.GetInstance; activityFactory.Register(ActivityTypes.GO_KART, new GoKartActivity()); activityFactory.Register(ActivityTypes.WALL_CLIMBING, new WallClimbingActivity()); activityFactory.Register(ActivityTypes.CHOCOLATE_PRODUCING_AND_MARKETING, new ChoclateProducingAndMarketingActivity()); activityFactory.Register(ActivityTypes.MEDITATION_AND_MINDFULLNESS, new MeditationAndMindfullnessActivity()); activityFactory.Register(ActivityTypes.TEAM_BUILDING_AND_PROBLEM_SOLVING, new TeamBuildingAndProblemSolvingActivity()); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); BookingGUI gui = new BookingGUI(); new BookingPresenter(gui); Application.Run(gui); }
public void TestFactoryCreateActivityReturnsInstanceOfRegisteredActivityType() { ActivityFactory factory = ActivityFactory.GetInstance; factory.Register(ActivityTypes.GO_KART, new GoKartActivity()); Assert.IsInstanceOfType(factory.CreateActivity(ActivityTypes.GO_KART, "An ID", 10.0M), typeof(GoKartActivity)); }
public void TestFactoryRegisterSucceeds() { ActivityFactory factory = ActivityFactory.GetInstance; PrivateObject privateAccessor = new PrivateObject(factory); WallClimbingActivity wallActivity = new WallClimbingActivity(); ChoclateProducingAndMarketingActivity chocoActivity = new ChoclateProducingAndMarketingActivity(); TeamBuildingAndProblemSolvingActivity teamActivity = new TeamBuildingAndProblemSolvingActivity(); MeditationAndMindfullnessActivity mediActivity = new MeditationAndMindfullnessActivity(); GoKartActivity goKartActivity = new GoKartActivity(); factory.Register(ActivityTypes.WALL_CLIMBING, wallActivity); factory.Register(ActivityTypes.TEAM_BUILDING_AND_PROBLEM_SOLVING, teamActivity); factory.Register(ActivityTypes.CHOCOLATE_PRODUCING_AND_MARKETING, chocoActivity); factory.Register(ActivityTypes.MEDITATION_AND_MINDFULLNESS, mediActivity); factory.Register(ActivityTypes.GO_KART, goKartActivity); Hashtable refActivityMap = (Hashtable)privateAccessor.GetField("activityTable"); Assert.IsTrue(refActivityMap.ContainsKey(ActivityTypes.WALL_CLIMBING)); Assert.IsTrue(refActivityMap.ContainsKey(ActivityTypes.TEAM_BUILDING_AND_PROBLEM_SOLVING)); Assert.IsTrue(refActivityMap.ContainsKey(ActivityTypes.CHOCOLATE_PRODUCING_AND_MARKETING)); Assert.IsTrue(refActivityMap.ContainsKey(ActivityTypes.MEDITATION_AND_MINDFULLNESS)); Assert.IsTrue(refActivityMap.ContainsKey(ActivityTypes.GO_KART)); }