public void ProvideNegativeIndex() { var madLibsMenu = new MadLibsMenu(); var madLib = madLibsMenu.GetMadLib(Console.Out, new StringReader("-1")); Assert.IsNull(madLib, "Madlib was selected when none should have been selected."); }
public void ProvideTooLargeIndex() { var madLibsMenu = new MadLibsMenu(); var madLib = madLibsMenu.GetMadLib( Console.Out, new StringReader($"{madLibsMenu.MadLibs.Count + 2}")); Assert.IsNull(madLib, "Madlib was selected when none should have been selected."); }
public void SelectRandomMadlib() { var madLibsMenu = new MadLibsMenu(); var madLib = madLibsMenu.GetMadLib( Console.Out, new StringReader($"{madLibsMenu.MadLibs.Count + 1}")); Assert.IsNotNull(madLib, "No Madlib returned."); }
public void Play() { var madLibsMenu = new MadLibsMenu(); MadLib madLib = null; while (madLib == null) { madLib = madLibsMenu.GetMadLib(Console.Out, Console.In); } madLib.GetUserAnswers(Console.Out, Console.In); madLib.Print(Console.Out); }
public void SelectMadlib() { var madLibsMenu = new MadLibsMenu(); for (int i = 0; i < madLibsMenu.MadLibs.Count; i++) { var madLib = madLibsMenu.GetMadLib(Console.Out, new StringReader($"{i+1}")); Assert.AreEqual( madLibsMenu.MadLibs[i].MadLibName, madLib.MadLibName, "Selected Madlib name does not match expected name."); } }
public void GiveAnswersToMadLib() { var madLibsMenu = new MadLibsMenu(); var madLib = madLibsMenu.GetMadLib(Console.Out, new StringReader("1")); var answersBuilder = new StringBuilder(); for (int i = 1; i < 50; i++) { answersBuilder.Append($"{i}\n"); } var answers = answersBuilder.ToString(); madLib.GetUserAnswers(Console.Out, new StringReader(answers)); madLib.Print(Console.Out); }