示例#1
0
        public void Setup()
        {
            gameRepo   = new LiteGameRepository(connectionString);
            playerRepo = new LitePlayerRepository(connectionString);
            player1    = DatabaseHandler.GetArbitraryPlayer("1");;
            player2    = DatabaseHandler.GetArbitraryPlayer("2");;
            player3    = DatabaseHandler.GetArbitraryPlayer("3");;
            player4    = DatabaseHandler.GetArbitraryPlayer("4");;

            player1 = playerRepo.Add(player1);
            player2 = playerRepo.Add(player2);
            player3 = playerRepo.Add(player3);
            player4 = playerRepo.Add(player4);

            game = new Game
            {
                RedScore    = 10,
                BlueScore   = 9,
                BlueOffense = player1.ID,
                BlueDefense = player2.ID,
                RedOffense  = player3.ID,
                RedDefense  = player4.ID
            };

            game = gameRepo.Add(game);
        }
        public void AddGameShouldUpdatePlayerTest()
        {
            game = gameRepo.Add(game);
            var resultPlayer1 = playerRepo.GetPlayerById(player1.ID);
            var resultPlayer2 = playerRepo.GetPlayerById(player2.ID);
            var resultPlayer3 = playerRepo.GetPlayerById(player3.ID);
            var resultPlayer4 = playerRepo.GetPlayerById(player4.ID);

            resultPlayer1.Should().BeEquivalentTo(player1);
            resultPlayer2.Should().BeEquivalentTo(player2);
            resultPlayer3.Should().BeEquivalentTo(player3);
            resultPlayer4.Should().BeEquivalentTo(player4);
        }