public void PlayRightTest() { Sounds sound = new Sounds(); Assert.IsTrue(sound.PlayRight(true)); Assert.IsFalse(sound.PlayRight(false)); }
/// <summary> /// Event handler for user clicking the button labeled set. /// </summary> /// <param name="sender">The parameter is not used.</param> /// <param name="e">The parameter is not used.</param> private void SetButtonClick(object sender, EventArgs e) { Sounds sound = new Sounds(); string directoryName = Path.GetDirectoryName(Directory.GetCurrentDirectory()); directoryName = Path.GetDirectoryName(directoryName); directoryName = Path.GetDirectoryName(directoryName); directoryName = directoryName + "\\set_sounds\\sound_options.txt"; string text = System.IO.File.ReadAllText(directoryName); // Set Logic if (cardsSelected == 3) { int set = game.ConfirmSet(currentSet); if (currentSet.Count() == 3 && set > 0) { if (text == "true") { sound.PlayRight(true); } if (set == 2) { if ("Yes" == MessageBox.Show("Do you want to see the sets you made?", "Congratulations?", MessageBoxButtons.YesNo).ToString()) { var card = game.getUserSets(); string toDisplay = ""; string line = ""; for(int i = 0; i < card.Count; i ++) { line = "Set" + i + ": "; for(int j = 0; j < card[i].Count; j++) { line += card[i][j].Number + "_" + card[i][j].Color + "_" + card[i][j].Shade + "_" + card[i][j].Shape + ", "; } toDisplay = string.Join(Environment.NewLine, line); } MessageBox.Show(toDisplay); } this.Close(); } else { MessageBox.Show("You have a valid set, YAY!"); updateCardsOnBoard(); clearSelectedCards(); } } else { if (text == "true") { sound.PlayWrong(true); } MessageBox.Show("Your SET is NOT valid!"); } // Fix this if you use multiple players player1Score.Text = game.getUserScore().ToString(); } else { MessageBox.Show("You need to have 3 cards selected to declare a SET"); } }