public void AggregateServiceShouldDelegateToListenersOnCreate()
        {
            //Arrange
            _details = A.Fake<GameDetailsProjection>();
            var appservice = _appserviceFactory();

            //Act
            appservice.Handle(new CreateGameCommand(Guid.NewGuid(), string.Empty, "test", 2));

            //Assert
            _details.CallsTo(gd => gd.Handle((GameCreatedEvent)null))
                .WithAnyArguments().MustHaveHappened(Repeated.Exactly.Once);
        }
        public void AggregateServiceShouldDelegateToListenersOnStarted()
        {
            //Arrange
            _details = A.Fake<GameDetailsProjection>();
            _openGames = A.Fake<OpenGamesProjection>();
            var id = Guid.NewGuid();

            //Act, Assert
            PlayGame(d => _details.CallsTo(gd => gd.Handle((GameStartedEvent)null)).WithAnyArguments().MustHaveHappened(Repeated.Exactly.Once),
                new CreateGameCommand(id, string.Empty, "test", 1),
                new JoinGameCommand(id, "*****@*****.**")
                );
        }
        public void Setup()
        {
            _details = new GameDetailsProjection();
            _openGames = new OpenGamesProjection();

            var eventStoreFactory = new Lazy<IEventStore>(() =>
                                              {
                                                  var eventListener = new EventListner(new List<IProjection> { _details, _openGames });
                                                  return new DelegatingEventStore(new InMemoryEventStore(), new List<IEventListner> { eventListener });
                                              });

            _appserviceFactory = () => new ApplicationService<Game>(eventStoreFactory.Value);
        }