예제 #1
0
        public void correctSwitchPlayers()
        {
            BaseOfWords  baseWords = new BaseOfWords();
            ManagerClass manager   = new ManagerClass(baseWords);

            manager.ListPlayers.Add(new Player("Ivan"));
            manager.ListPlayers.Add(new Player("Pasha"));

            manager.switchPlayer();
            Assert.AreEqual(1, manager.IndexPlayer);
            manager.switchPlayer();
            Assert.AreEqual(0, manager.IndexPlayer);
        }
예제 #2
0
        public void timerCallSwitchPlayers()
        {
            BaseOfWords  baseWords = new BaseOfWords();
            ManagerClass manager   = new ManagerClass(baseWords);

            manager.ListPlayers.Add(new Player("Ivan"));
            manager.ListPlayers.Add(new Player("Pasha"));

            Timer MyTimer = new Timer(manager, 2);

            MyTimer.takeOneSecond();
            MyTimer.takeOneSecond();

            Assert.AreEqual(1, manager.IndexPlayer);
        }
예제 #3
0
        public void checkWordTesting()
        {
            BaseOfWords  baseWords = new BaseOfWords();
            ManagerClass manager   = new ManagerClass(baseWords);

            manager.UsedCities.Add("Новосибирск");
            Assert.AreEqual(manager.checkWord("Кемерово"), 1);

            Assert.AreEqual(manager.checkWord("Оаку"), 0);

            manager.UsedCities[0] = "Омск";
            Assert.AreEqual(manager.checkWord("Омск"), -1);

            Assert.AreEqual(manager.checkWord("Барнаул"), -2);

            manager.UsedCities.Add("Астрахань");
            Assert.AreEqual(manager.checkWord("Норильск"), 1);
        }
예제 #4
0
        public void determWinner()
        {
            BaseOfWords  baseWords = new BaseOfWords();
            ManagerClass manager   = new ManagerClass(baseWords);

            manager.ListPlayers.Add(new Player("Ilon"));
            manager.ListPlayers[manager.ListPlayers.Count - 1].points = 10;
            manager.ListPlayers.Add(new Player("Mask"));
            manager.ListPlayers[manager.ListPlayers.Count - 1].points = 12;
            manager.ListPlayers.Add(new Player("Oleg"));
            manager.ListPlayers[manager.ListPlayers.Count - 1].points = 11;

            var winners = manager.endGame();

            Assert.AreEqual(winners[0], "Mask");

            manager.ListPlayers[manager.ListPlayers.Count - 1].points = 12;
            winners.Clear();
            winners = manager.endGame();
            Assert.AreEqual(winners[0], "Mask");
            Assert.AreEqual(winners[1], "Oleg");
        }
예제 #5
0
        public void testSearchCity()
        {
            BaseOfWords baseWords = new BaseOfWords();

            Assert.AreEqual(true, baseWords.searchCity("Барнаул"));
        }
예제 #6
0
        public void loadBaseOfCities()
        {
            BaseOfWords baseWords = new BaseOfWords();

            Assert.AreEqual(1121, baseWords.Cities.Length);
        }