コード例 #1
0
        public void GetAllPlayersFileOKTest()
        {
            string            filePath    = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "App_Data/headtohead.json");
            PlayersManagement playerMgt   = new PlayersManagement();
            List <Player>     playerslist = playerMgt.GetAllPlayers(filePath);

            Assert.AreEqual(5, playerslist.Count);
        }
コード例 #2
0
        public void GetNotExistantPlayerByIdTest()
        {
            int               id             = 1;
            string            filePath       = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "App_Data/headtohead.json");
            PlayersManagement playerMgt      = new PlayersManagement();
            List <Player>     playersList    = playerMgt.GetAllPlayers(filePath);
            Player            existantPlayer = playerMgt.GetPlayerById(playersList, id);

            Assert.AreEqual(null, existantPlayer);
        }
コード例 #3
0
        public void DeleteExistantPlayerByIdTest()
        {
            int               id            = 17;
            string            filePath      = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "App_Data/headtohead.json");
            PlayersManagement playerMgt     = new PlayersManagement();
            List <Player>     playersList   = playerMgt.GetAllPlayers(filePath);
            Player            deletedPlayer = playerMgt.DeletePlayerById(playersList, id);

            Assert.AreEqual(17, deletedPlayer.id);
            Assert.AreEqual(4, playersList.Count);
        }