Exemplo n.º 1
0
        public void Timeout_NoCorrectGuess_StateSetToSwitchTeamAndAddBonusLetter()
        {
            var puzzleEntry = new WordPuzzleEntry(new[]
            {
                new WordPuzzleLetterEntry('a', LetterState.CorrectLocation),
                new WordPuzzleLetterEntry('a', LetterState.CorrectLocation),
                new WordPuzzleLetterEntry('a', LetterState.CorrectLocation),
                new WordPuzzleLetterEntry('b', LetterState.IncorrectLocation),
                new WordPuzzleLetterEntry('b', LetterState.IncorrectLocation),
            });

            var wordPuzzleMock = new Mock <WordPuzzle>("aaaaa");

            wordPuzzleMock.Setup(x => x.Solve(It.IsAny <string>())).Returns(puzzleEntry);


            WordGame wordGame = new WordGame(wordPuzzleMock.Object, 0);

            wordGame.Solve("aaabb");
            wordGame.TimeOut();

            Assert.AreEqual(1, wordGame.ActiveTeamIndex);
            Assert.AreEqual(1, wordGame.AttemptIndex);
            Assert.AreEqual(WordGameState.SwitchTeam, wordGame.State.State);
            Assert.IsTrue((wordGame.State.Flags & SwitchTeamFlags.AddRow) != SwitchTeamFlags.AddRow);
            Assert.IsTrue((wordGame.State.Flags & SwitchTeamFlags.AddBonusLetter) == SwitchTeamFlags.AddBonusLetter);
        }
Exemplo n.º 2
0
 public async Task <WordGameStateInfo> TimeOut()
 {
     _audioPlaybackEngine.PlaySound(_timeOutSound);
     _wordGame.TimeOut();
     _state.SwitchActiveTeam();
     return(_wordGame.State);
 }
Exemplo n.º 3
0
        public void Timeout_WordAlmostGuessed_StateSetToSwitchTeam()
        {
            var puzzleEntry = new WordPuzzleEntry(new[]
            {
                new WordPuzzleLetterEntry('a', LetterState.CorrectLocation),
                new WordPuzzleLetterEntry('a', LetterState.CorrectLocation),
                new WordPuzzleLetterEntry('a', LetterState.CorrectLocation),
                new WordPuzzleLetterEntry('a', LetterState.CorrectLocation),
                new WordPuzzleLetterEntry('b', LetterState.IncorrectLocation),
            });

            var wordPuzzleMock = new Mock <WordPuzzle>("aaaaa");

            wordPuzzleMock.Setup(x => x.Solve(It.IsAny <string>())).Returns(puzzleEntry);


            WordGame wordGame = new WordGame(wordPuzzleMock.Object, 0);

            wordGame.Solve("aaaab");
            wordGame.TimeOut();

            Assert.AreEqual(1, wordGame.ActiveTeamIndex);
            Assert.AreEqual(1, wordGame.AttemptIndex);
            Assert.AreEqual(WordGameState.SwitchTeam, wordGame.State.State);
            Assert.AreEqual(SwitchTeamFlags.ClearRow, wordGame.State.Flags);
        }