Ejemplo n.º 1
0
 public CompositionRootBuilder()
 {
     domainEventChannelFactory = new DomainEventChannelFactory();
     gameBuilder           = new GameBuilder();
     commandChannelFactory = new UICommandChannelFactory();
     gameViewFactory       = new GameViewFactory();
 }
Ejemplo n.º 2
0
        public CompositionRoot(IDomainEventChannelFactory domainEventChannelFactory,
                               IGameBuilder gameBuilder,
                               IUICommandChannelFactory commandChannelFactory,
                               IGameViewFactory gameViewFactory)
        {
            this.GameId = Guid.NewGuid();


            this.domainEventChannel = MaybeConvertions.ToMaybe(domainEventChannelFactory.Create());

            // Application
            gameService = new GameService(this.domainEventChannel,
                                          new GameInMemoryRepository(),
                                          gameBuilder);

            gameService.GenerateNewGame(this.GameId);


            // View
            this.uiCommandChannel = commandChannelFactory.Create();
            this.gameView         = gameViewFactory.Create(this.uiCommandChannel);

            // Handlers
            this.fromUICommandsToDomainHandler =
                new FromUICommandsToDomainHandler(this.uiCommandChannel, this.gameService, this.GameId);

            this.fromDomainEventsToViewHandler =
                new FromDomainEventsToViewHandler(this.domainEventChannel, this.gameView);
        }
Ejemplo n.º 3
0
        public GameController(ISolitaireGameModel gameModel, IGameViewFactory gameViewFactory)
        {
            if (gameModel == null)
            {
                throw new ArgumentNullException(nameof(gameModel));
            }

            if (gameViewFactory == null)
            {
                throw new ArgumentNullException(nameof(gameViewFactory));
            }

            _gameModel = gameModel;
            _gameView  = gameViewFactory.Create(this, gameModel);
        }
Ejemplo n.º 4
0
        public CompositionRoot(IDomainEventChannelFactory domainEventChannelFactory,
                               IGameBuilder gameBuilder,
                               IUICommandChannelFactory commandChannelFactory,
                               IGameViewFactory gameViewFactory)
        {
            // Domain
            this.domainEventChannel = domainEventChannelFactory.Create();
            this.game = gameBuilder.Create(this.domainEventChannel);

            // View
            this.uiCommandChannel = commandChannelFactory.Create();
            this.gameView         = gameViewFactory.Create(this.uiCommandChannel);

            // Handlers
            this.fromUICommandsToDomainHandler =
                new FromUICommandsToDomainHandler(this.uiCommandChannel, this.game);

            this.fromDomainEventsToViewHandler =
                new FromDomainEventsToViewHandler(this.domainEventChannel, this.gameView);
        }
Ejemplo n.º 5
0
 public CompositionRootBuilder WithGameViewFactory(IGameViewFactory gameViewFactory)
 {
     this.gameViewFactory = gameViewFactory;
     return(this);
 }