public ActionResult Update(string letter) { // Use the word that was just created MysteryWord playerWord = MysteryWord.Find(1); bool duplicate = playerWord.AlreadyGuessed(letter); if (duplicate) { ViewBag.Message = string.Format("Hello {0}.\\nCurrent Date and Time: {1}", letter, DateTime.Now.ToString()); Console.WriteLine("Already guessed this letter. Try a different letter."); } else { playerWord.AddLetter(letter); bool isMatch = playerWord.CheckLetter(); if (isMatch) { bool win = playerWord.Win(); // For all blanks that are that letter, fill them in } else { playerWord.Score++; } bool lose = playerWord.isGameOver(); if (lose) { Console.WriteLine("You lose"); } } return(View(playerWord)); }
public void Find_ReturnWordListThis_MysteryWord() { // Setup string myWord1 = "James Burke"; string myWord2 = "Carl Sagan"; MysteryWord newWord1 = new MysteryWord(myWord1); MysteryWord newWord2 = new MysteryWord(myWord2); // Test the function MysteryWord result = MysteryWord.Find(2); //Assert Assert.AreEqual(result, newWord2); }