public void Setup() { var scoreCalculator = new SimpleScoreCalculator(); _scoreQuery = new ScoreQuery(new Mock<ISignaler>().Object, scoreCalculator); var eventBus = new DomainBus(); eventBus.RegisterHandler(() => new GameHandler(_scoreQuery)); var eventStorage = new InMemoryEventStorage(); var sessionFactory = new SessionFactory(eventStorage); var gameService = new GameService(sessionFactory, eventBus); _commandbus = new DomainBus(); _commandbus.RegisterHandler(() => gameService); }
private static void Main(string[] args) { //throw new UnauthorizedAccessException("This migration is complete dont run twice."); Console.WriteLine("Starting migration"); var bus = new DomainBus(); var destinationStorage = new RaventEventStorage(new ServerStoreFactory("RavenHq"), bus); var handler = new MigrationHandler(destinationStorage); bus.RegisterHandler(()=>handler); new RaventEventStorage(new ServerStoreFactory(), bus); Console.WriteLine("Migration complete"); Console.ReadKey(); }
private static void Main(string[] args) { //throw new UnauthorizedAccessException("This migration is complete dont run twice."); Console.WriteLine("Starting migration"); var bus = new DomainBus(); var destinationStorage = new RaventEventStorage(new ServerStoreFactory("RavenHq"), bus); var handler = new MigrationHandler(destinationStorage); bus.RegisterHandler(() => handler); new RaventEventStorage(new ServerStoreFactory(), bus); Console.WriteLine("Migration complete"); Console.ReadKey(); }
public void Setup() { var scoreCalculator = new SimpleScoreCalculator(); _scoreQuery = new ScoreQuery(new Mock <ISignaler>().Object, scoreCalculator); var eventBus = new DomainBus(); eventBus.RegisterHandler(() => new GameHandler(_scoreQuery)); var eventStorage = new InMemoryEventStorage(); var sessionFactory = new SessionFactory(eventStorage); var gameService = new GameService(sessionFactory, eventBus); _commandbus = new DomainBus(); _commandbus.RegisterHandler(() => gameService); }
/// <summary> /// Load your modules or register your services here! /// </summary> /// <param name="kernel">The kernel.</param> private static void RegisterServices(IKernel kernel) { var scoreCalculator = new EloCalculator(); var scoreQuery = new ScoreQuery(new WebSignaler(), scoreCalculator); var eventBus = new DomainBus(); var teamService = new TeamService(); eventBus.RegisterHandler(() => new GameHandler(scoreQuery)); eventBus.RegisterHandler(() => teamService); kernel.Bind<IScoreQuery>().ToConstant(scoreQuery); kernel.Bind<ITeamService>().ToConstant(teamService); var eventStorage = GetEventStorage(eventBus); var sessionFactory = new SessionFactory(eventStorage); kernel.Bind<IEventStorage>().ToConstant(eventStorage); kernel.Bind<ISessionFactory>().ToConstant(sessionFactory); var gameService = new GameService(sessionFactory, eventBus); var commandbus = new DomainBus(); commandbus.RegisterHandler(() => gameService); kernel.Bind<IBus>().ToConstant(commandbus); }
/// <summary> /// Load your modules or register your services here! /// </summary> /// <param name="kernel">The kernel.</param> private static void RegisterServices(IKernel kernel) { var scoreCalculator = new EloCalculator(); var scoreQuery = new ScoreQuery(new WebSignaler(), scoreCalculator); var eventBus = new DomainBus(); var teamService = new TeamService(); eventBus.RegisterHandler(() => new GameHandler(scoreQuery)); eventBus.RegisterHandler(() => teamService); kernel.Bind <IScoreQuery>().ToConstant(scoreQuery); kernel.Bind <ITeamService>().ToConstant(teamService); var eventStorage = GetEventStorage(eventBus); var sessionFactory = new SessionFactory(eventStorage); kernel.Bind <IEventStorage>().ToConstant(eventStorage); kernel.Bind <ISessionFactory>().ToConstant(sessionFactory); var gameService = new GameService(sessionFactory, eventBus); var commandbus = new DomainBus(); commandbus.RegisterHandler(() => gameService); kernel.Bind <IBus>().ToConstant(commandbus); }