public void Reject_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.Reject(); Assert.AreEqual(1, wordGame.ActiveTeamIndex); Assert.AreEqual(1, wordGame.AttemptIndex); Assert.AreEqual(WordGameState.SwitchTeam, wordGame.State.State); Assert.IsTrue((wordGame.State.Flags & SwitchTeamFlags.ClearRow) == SwitchTeamFlags.ClearRow); }
/// <summary> /// Reject the word that was previously set /// </summary> public async Task <WordGameStateInfo> RejectWord() { _audioPlaybackEngine.PlaySound(_rejectSound); _wordGame.Reject(); _state.SwitchActiveTeam(); return(_wordGame.State); }
public void Reject_KeepsIndexButSwitchesTeam() { var puzzleEntry = new WordPuzzleEntry(Enumerable.Repeat(new WordPuzzleLetterEntry('a', LetterState.IncorrectLocation), 5).ToArray()); var wordPuzzleMock = new Mock <WordPuzzle>("aaaa"); wordPuzzleMock.Setup(x => x.Solve(It.IsAny <string>())).Returns(puzzleEntry); WordGame wordGame = new WordGame(wordPuzzleMock.Object, 0); wordGame.Reject(); Assert.AreEqual(1, wordGame.ActiveTeamIndex); Assert.AreEqual(0, wordGame.AttemptIndex); Assert.AreEqual(WordGameState.SwitchTeam, wordGame.State.State); Assert.IsTrue((wordGame.State.Flags & SwitchTeamFlags.ClearRow) == SwitchTeamFlags.ClearRow); Assert.IsTrue((wordGame.State.Flags & SwitchTeamFlags.AddBonusLetter) == SwitchTeamFlags.AddBonusLetter); }