public void Register <TRequest, THandler, TMapper>() where TRequest : class, IRequest where TMapper : class, IAmAMessageMapper <TRequest> where THandler : class, IHandleRequests <TRequest> { _mappers.Register <TRequest, TMapper>(); _handlers.Register <TRequest, THandler>(); }
public void should_throw_if_type_not_found() { var factory = new HandlerFactory(); factory.Register(typeof(TypeA)).Register(typeof(TypeB)); Assert.Throws <InvalidOperationException>(() => factory.Create("NotExistedType")); }
public static void Register() { //ここでTeamHandlerBaseを登録してください(このメソッドはUIから自動的に呼び出されます //HandlerFactory.Register("name", () => new TeamHandlerBase()); HandlerFactory.Register("有用領域探索", () => new UsefulRegionSearch()); HandlerFactory.Register("近傍領域探索", () => new NearRegionSearch()); HandlerFactory.Register("Wayテスト", () => new WayTest()); }
public void should_create_instance_of_named_type_case_insensitively() { var factory = new HandlerFactory(); factory.Register(typeof(TypeA)).Register(typeof(TypeB)); object instance = factory.Create(typeof(TypeA).FullName.ToLowerInvariant()); Assert.Equal(typeof(TypeA), instance); }
public static void Register() { //ここでTeamHandlerBaseを登録してください(このメソッドはUIから自動的に呼び出されます //HandlerFactory.Register("name", () => new TeamHandlerBase()); //HandlerFactory.Register("力任せ法", () => new BruteForceSearchTeamHandler()); // HandlerFactory.Register("力任せ法 改D1", () => new NoneCollisionTeamHandler((g, a) => new BruteForceSearchAgentHandler(g, a, 1), (g, a) => new BruteForceSearchAgentHandler(g, a, 1))); HandlerFactory.Register("力任せ法 改D3", () => new NoneCollisionTeamHandler((g, a) => new BruteForceSearchAgentHandler(g, a, 3), (g, a) => new BruteForceSearchAgentHandler(g, a, 3))); HandlerFactory.Register("力任せ法 改D4", () => new NoneCollisionTeamHandler((g, a) => new BruteForceSearchAgentHandler(g, a, 4), (g, a) => new BruteForceSearchAgentHandler(g, a, 4))); //HandlerFactory.Register("敵領域妨害法", () => new EnemyTerritoryDeleteTeamHandler()); //HandlerFactory.Register("敵領域妨害法 改", () => new NoneCollisionTeamHandler((g, a) => new EnemyTerritoryDeleteAgentHandler(g, a), (g, a) => new EnemyTerritoryDeleteAgentHandler(g, a))); HandlerFactory.Register("敵領域妨害法 Agent1", () => new NoneCollisionTeamHandler((g, a) => new EnemyTerritoryDeleteAgentHandler(g, a), (g, a) => new StayAgentHandler(g, a))); HandlerFactory.Register("敵領域妨害法 ", () => new NoneCollisionTeamHandler((g, a) => new EnemyTerritoryDeleteAgentHandler(g, a), (g, a) => new BruteForceSearchAgentHandler(g, a, 3))); //HandlerFactory.Register("待機", () => new NoneCollisionTeamHandler((g, a) => new StayAgentHandler(g, a), (g, a) => new StayAgentHandler(g, a))); HandlerFactory.Register("疑似最善経路探索法", () => new NoneCollisionTeamHandler((g, a) => new BetterRoutesSearchAgentHandler(g, a), (g, a) => new BetterRoutesSearchAgentHandler(g, a))); HandlerFactory.Register("アルゴリズム複合行動決定法", () => new SelectBestAlgorithmTeamHandler((g, a) => new StayAgentHandler(g, a), (g, a) => new BetterRoutesSearchAgentHandler(g, a), (g, a) => new EnemyTerritoryDeleteAgentHandler(g, a), (g, a) => new BruteForceSearchAgentHandler(g, a, 3))); }