コード例 #1
0
ファイル: LobbyMapperTest.cs プロジェクト: Daniel--cai/Dixit
        public void ReverseMapDataWithRounds_ShouldReturnSameLobby()
        {
            //arrange
            var lobbyMapper = new LobbyMapper(_mapperFixture.GetLobbyMapper());
            var lobby       = new LobbyBuilder()
                              .WithPlayers(_players)
                              .WithRoundOne()
                              .WithPlayedCards()
                              .WithVotedCards()
                              .WithRoundTwo()
                              .Build();
            var data = lobbyMapper.Map(lobby);

            //act
            var dataReversed = lobbyMapper.Map(lobbyMapper.Map(data));

            //assert
            data.Should().BeEquivalentTo(dataReversed);
        }
コード例 #2
0
ファイル: LobbyMapperTest.cs プロジェクト: Daniel--cai/Dixit
        public void ReverseMapAggregateInitialGame_ShouldReturnSameLobby()
        {
            //arrange
            var lobbyMapper = new LobbyMapper(_mapperFixture.GetLobbyMapper());
            var lobby       = new LobbyBuilder()
                              .WithPlayers(_players)
                              .Build();

            lobby.NewRound();
            lobby.DealDeck();

            //act
            var data          = lobbyMapper.Map(lobby);
            var lobbyReversed = lobbyMapper.Map(lobbyMapper.Map(lobby));

            //assert

            lobby.Should().BeEquivalentTo(lobbyReversed);
            lobby.Rounds.Count.Should().Be(1);
        }
コード例 #3
0
ファイル: LobbyMapperTest.cs プロジェクト: Daniel--cai/Dixit
        public void AggregateLobbyStoryTellerShouldEqualDataStoryTellerOwner()
        {
            //arrange
            var lobbyMapper = new LobbyMapper(_mapperFixture.GetLobbyMapper());
            var lobby       = new LobbyBuilder()
                              .WithPlayers(_players)
                              .WithRoundOne()
                              .WithPlayedCards()
                              .Build();

            //act
            var lobbyReversed = lobbyMapper.Map(lobbyMapper.Map(lobby));

            //assert
            lobbyReversed.CurrentRound.Story.Should().Equals(lobby.CurrentRound.Story);
            lobbyReversed.CurrentRound.StoryTeller.Should().Equals(lobby.CurrentRound.StoryTeller);
            lobbyReversed.CurrentRound.StoryTellerCard.Should().Equals(lobby.CurrentRound.StoryTellerCard);
            lobbyReversed.CurrentRound.StoryTellerCard.Owner.Should().Be(lobby.CurrentRound.StoryTeller);
            lobbyReversed.CurrentRound.StoryTellerCard.Owner.Should().NotBeNull();
        }
コード例 #4
0
ファイル: LobbyMapperTest.cs プロジェクト: Daniel--cai/Dixit
        public void ReverseMapAggregateWithRounds_ShouldReturnSameLobby()
        {
            //arrange
            var lobbyMapper = new LobbyMapper(_mapperFixture.GetLobbyMapper());
            var lobby       = new LobbyBuilder()
                              .WithPlayers(_players)
                              .WithRoundOne()
                              .WithPlayedCards()
                              .WithVotedCards()
                              .Build();

            //act
            var data          = lobbyMapper.Map(lobby);
            var lobbyReversed = lobbyMapper.Map(lobbyMapper.Map(lobby));

            //assert
            lobby.Should().BeEquivalentTo(lobbyReversed);
            lobby.Rounds.Count.Should().Be(1);
            lobby.CurrentStoryCard.Owner.Should().NotBeNull();
            lobby.CurrentStoryCard.Owner.Should().BeEquivalentTo(lobby.CurrentStoryTeller);
        }
コード例 #5
0
ファイル: LobbyMapperTest.cs プロジェクト: Daniel--cai/Dixit
        public void AggregateLobbyGameState_ShouldEqualDataLobbyGameState()
        {
            //arrange
            var lobbyMapper = new LobbyMapper(_mapperFixture.GetLobbyMapper());
            var lobby       = new LobbyBuilder()
                              .WithPlayers(_players)
                              .WithRoundOne()
                              .WithPlayedCards()
                              .WithVotedCards()
                              .Build();
            //act
            var data = lobbyMapper.Map(lobby);

            //assert
            data.GameState.Should().Equals(lobby.GameState);
        }
コード例 #6
0
ファイル: LobbyMapperTest.cs プロジェクト: Daniel--cai/Dixit
        public void AggregateLobbyStoryTellerShouldEqualDataStoryTeller()
        {
            //arrange
            var lobbyMapper = new LobbyMapper(_mapperFixture.GetLobbyMapper());
            var lobby       = new LobbyBuilder()
                              .WithPlayers(_players)
                              .WithRoundOne()
                              .WithPlayedCards()
                              .WithVotedCards()
                              .WithRoundTwo()
                              .Build();

            //act
            var data = lobbyMapper.Map(lobby);

            //assert
            var round = Newtonsoft.Json.JsonConvert.DeserializeObject <List <Round> >(data.Rounds).Last();

            round.Story.Should().Equals(lobby.CurrentRound.Story);
            round.StoryTeller.Should().Equals(lobby.CurrentRound.StoryTeller);
            round.StoryTellerCard.Should().Equals(lobby.CurrentRound.StoryTellerCard);
            round.StoryTellerCard.Should().Equals(lobby.CurrentRound.StoryTellerCard);
        }