Exemple #1
0
 private static void PlayFirstTricksGuessesAndCards(GameEventHub originalHub)
 {
     originalHub.MoveToNextRound();
     originalHub.StartCurrentRound();
     originalHub.TryGiveGuess(0, 2);
     originalHub.TryGiveGuess(1, 3);
     originalHub.TryGiveGuess(2, 4);
     originalHub.TryPlayCard(0, ((KnownHand)originalHub.State.Players[0].Hand).First());
     originalHub.TryPlayCard(1, ((KnownHand)originalHub.State.Players[1].Hand).First());
     originalHub.TryPlayCard(2, ((KnownHand)originalHub.State.Players[2].Hand).First());
 }
Exemple #2
0
        public void ResumingTheFirstEventsLeadsToSameState()
        {
            var gameRoomDef = GenGameRoomDefinitionFor3Players();
            var originalHub = new GameEventHub(gameRoomDef, GameProgress.NotStarted);
            // var forwardedHub = new GameEventHub("test", plan, 3);
            var originalHubObserver = new TransparentObserver();

            PlayFirstTricksGuessesAndCards(originalHub);
            // First trick over!
            originalHub.MoveToNextRound();
            originalHub.StartCurrentRound();
            originalHub.TryGiveGuess(1, 3);
            originalHub.SubscribeWithPreviousEvents(originalHubObserver);

            var progress = new GameProgress(
                new GameSeriesEvent[] { new RoundStarted("", null), new RoundStarted("", null) }.ToImmutableList().WithValueSemantics(),
                originalHubObserver.ObservedEvents.ToImmutableList().WithValueSemantics());
            var resumingHub = new GameEventHub(gameRoomDef, progress);

            Assert.Equal(originalHub.State, resumingHub.State);
        }