Пример #1
0
        public void PMGetAPlayerScoreTest()
        {
            // Test parameters
            string testName = "Zelda";
            bool testStatus = true;
            int testNumScores = 4,
                testScoreRet = 0;
            List<int> testScores = new List<int>() { 45, 10, 8, 4, 0 };    // Test score ArrayList
            Player newPlayer = new Player(testName, testStatus,
                                        testNumScores, testScores);

            PlayerManager testPlayMngr = new PlayerManager();

            // Use a For loop to check each value
            for (int i = 0; i < testNumScores; i++)
            {
                testScoreRet = testPlayMngr.GetAPlayerScore(newPlayer, i);
                Assert.AreEqual(testScores[i], testScoreRet);
            }
        }
Пример #2
0
        private void FillScoreList(Player GamePlayer)
        {
            // Create Player Manager
            PlayerManager playerManager = new PlayerManager();

            // Clear current scores to populate in order
            this.ScoreListBox.Items.Clear();

            // Load player scores from object
            if (GamePlayer.NumberOfScores > 0)
            {

                for (int i = 0; i < GamePlayer.NumberOfScores; i++)
                {
                    this.ScoreListBox.Items.Add(playerManager.GetAPlayerScore(GamePlayer, i).ToString());
                }
            }

            // Change label to reflect player name
            this.ScoreListLabel.Text = "Top Scores for " + GamePlayer.PlayerName + "!";
        }