public void Ex20_TestWithOneProduct5() { TestHelper t = new TestHelper(); t.SetupConsole(new string[] { "0", "0", "8" }); TestHelper.RunMain(typeof(Ex20)); t.AssertOutputContains((5600).ToString("c")); }
public void Ex20_TestWithTwoProducts1() { TestHelper t = new TestHelper(); t.SetupConsole(new string[] { "1", "20", "0" }); TestHelper.RunMain(typeof(Ex20)); t.AssertOutputContains((10900 * .85).ToString("c")); }
public void Ex16_TestWithFemale() { TestHelper t = new TestHelper(); t.SetupConsole(new string[] { "Jane Austen","F"}); TestHelper.RunMain(typeof (Ex16)); t.AssertOutput("Good Morning Ms. Jane Austen".ToString()); }
public void Ex14_TestWithPositiveNumber() { TestHelper t = new TestHelper(); t.SetupConsole(new string[] { "3","4","5"}); TestHelper.RunMain(typeof (Ex14)); t.AssertOutput(6.ToString()); }
public void Ex17_TestWithUnknown() { TestHelper t = new TestHelper(); t.SetupConsole(new string[] { "Jane Austen", "X", "20" }); TestHelper.RunMain(typeof(Ex17)); t.AssertOutputNotContaining("Jane Austen"); }
public void Ex01_TestWithName1() { TestHelper help = new TestHelper(); help.SetupConsole(new string[] {"John"}); Ex01.Main(null); help.AssertOutput("Good Morning John"); }
public void Ex10_TestWithPositiveNumber() { TestHelper t = new TestHelper(); t.SetupConsole(new string[] { "20","0","20","20"}); TestHelper.RunMain(typeof (Ex10)); t.AssertOutput(20.ToString()); }
public void Ex10_TestWithNegativeNumber() { TestHelper t = new TestHelper(); t.SetupConsole(new string[] { "20", "0", "-20", "-20" }); TestHelper.RunMain(typeof(Ex10)); t.AssertOutput(Math.Sqrt(40*40+20*20).ToString()); }
public void Ex17_TestWitMr() { TestHelper t = new TestHelper(); t.SetupConsole(new string[] { "Will Smith", "M" }); TestHelper.RunMain(typeof(Ex17)); t.AssertOutput("Good Morning Mr. Will Smith".ToString()); }
public void Ex17_TestWithUncle() { TestHelper t = new TestHelper(); t.SetupConsole(new string[] { "Arnold", "M", "40"}); TestHelper.RunMain(typeof(Ex17)); t.AssertOutput("Good Morning Uncle Arnold".ToString()); }
public void Ex16_TestWithMale() { TestHelper t = new TestHelper(); t.SetupConsole(new string[] { "John Smith", "M"}); TestHelper.RunMain(typeof(Ex16)); t.AssertOutput("Good Morning Mr. John Smith".ToString()); }
public void Ex14_TestWithZero() { TestHelper t = new TestHelper(); t.SetupConsole(new string[] { "0", "0", "0" }); TestHelper.RunMain(typeof(Ex14)); t.AssertOutput(0.ToString()); }
public void Ex23_TestRepeatedly() { bool cond1 = false; bool cond2 = false; bool cond3 = false; do { TestHelper t = new TestHelper(); t.SetupConsole(new string[] {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"}); TestHelper.RunMain(typeof (Ex23)); int count = t.GetOutputCount() - 1; if (count <= 2) { t.AssertOutputContains("wizard"); cond1 = true; } else if (count <= 5) { t.AssertOutputContains("good"); cond2 = true; } else { t.AssertOutputContains("lousy"); cond3 = true; } Thread.Sleep(100); } while (!(cond1 && cond2 && cond3)); }
public void Ex17_TestWithMs() { TestHelper t = new TestHelper(); t.SetupConsole(new string[] { "Ariana Grande", "F", "18" }); TestHelper.RunMain(typeof(Ex17)); t.AssertOutput("Good Morning Ms. Ariana Grande".ToString()); }
public void Ex17_TestWithAunty() { TestHelper t = new TestHelper(); t.SetupConsole(new string[] { "Madonna", "F", "51" }); TestHelper.RunMain(typeof (Ex17)); t.AssertOutput("Good Morning Aunty Madonna".ToString()); }
public void Ex27_TestTheOnlyCase() { TestHelper t = new TestHelper(); t.SetupConsole(""); TestHelper.RunMain(typeof (Ex27)); Assert.AreEqual(1, t.CountOutputContaining("73.0")); Assert.AreEqual(1, t.CountOutputContaining("51.0")); }
public void Ex21_TestWith88() { TestHelper t = new TestHelper(); Random r = new Random(); t.SetupConsole(new string[] { r.Next(1, 100).ToString(), r.Next(1, 100).ToString(), r.Next(1, 100).ToString(), "88" }); TestHelper.RunMain(typeof(Ex21)); t.AssertOutputContains("Lucky"); }
public void Ex45_Test105() { TestHelper t = new TestHelper(); t.SetupConsole("1.05"); TestHelper.RunMain(typeof(Ex45)); t.AssertOutputContains(1, "5c", true); t.AssertOutputContains(2, "100c", false); }
public void Ex35_TestWithRycky() { TestHelper t = new TestHelper(); t.SetupConsole("rykcy"); TestHelper.RunMain(typeof(Ex35)); t.WriteLog(); Assert.AreEqual(6, t.CountOutputContaining("0")); }
public static void TestOutputEqual(Type t, string input, string output) { TestHelper help = new TestHelper(); help.SetupConsole(input); RunMain(t); help.AssertOutput(output); }
public void Ex26_TestTheOnlyCase() { TestHelper t = new TestHelper(); t.SetupConsole(""); TestHelper.RunMain(typeof (Ex26)); t.AssertOutputContains(1, "3.162", true); t.AssertOutputContains(2, "0.111", false); t.AssertOutputContains(3, "64.0", false); }
public void Ex22_TestWithPositiveNumber2() { TestHelper t = new TestHelper(); Random r = new Random(); t.SetupConsole(new string[] { "2000", "120" }); TestHelper.RunMain(typeof(Ex22)); t.AssertOutputContains(2, "80", true); t.AssertOutputContains(1, "3000", false); }
public void Ex30_TestForTheOnlyTestCase() { TestHelper t = new TestHelper(); t.SetupConsole(""); TestHelper.RunMain(typeof (Ex30)); t.AssertOutputContains(1, "9973", true); t.AssertOutputContains(2, "9967", false); t.AssertOutputContains(3, "9949", false); }
public void Ex21_TestNo88() { TestHelper t = new TestHelper(); Random r = new Random(); t.SetupConsole(new string[] { r.Next(1, 100).ToString(), r.Next(1, 100).ToString(), r.Next(1, 100).ToString(), "87" }); bool completed = TestHelper.ExecuteMain(typeof(Ex21),100); Assert.IsFalse(completed,"The program is not supposed to complete, but it is."); t.WriteLog(); }
public void Ex31_TestForTheOnlyTestCase() { TestHelper t = new TestHelper(); t.SetupConsole(""); TestHelper.RunMain(typeof(Ex31)); t.AssertOutputContains(1, "496", true); t.AssertOutputContains(2, "28", false); t.AssertOutputContains(3, "6", false); }
public void Ex35_TestWithAeiou() { TestHelper t = new TestHelper(); t.SetupConsole("AEIOUaeiou"); TestHelper.RunMain(typeof(Ex35)); t.WriteLog(); Assert.AreEqual(1, t.CountOutputContaining("10")); Assert.AreEqual(5, t.CountOutputContaining("2")); }
public void Ex38_TestOrder() { TestHelper t = new TestHelper(); t.SetupConsole(""); TestHelper.RunMain(typeof (Ex38)); t.AssertOutputContains(1, "Victor", true); t.AssertOutputContains(2, "Venkat", false); t.AssertOutputContains(3, "Mary", false); t.AssertOutputContains(4, "John", false); }
public void Ex35_TestWithABCDE() { TestHelper t = new TestHelper(); t.SetupConsole("Abcde"); TestHelper.RunMain(typeof(Ex35)); t.WriteLog(); Assert.AreEqual(1, t.CountOutputContaining("2")); Assert.AreEqual(2, t.CountOutputContaining("1")); Assert.AreEqual(3, t.CountOutputContaining("0")); }
public void Ex34_TestForSomeOfTheResult() { TestHelper t = new TestHelper(); t.SetupConsole(""); TestHelper.RunMain(typeof (Ex34)); t.WriteLog(); Assert.AreEqual(1, t.CountOutputContaining("230")); Assert.AreEqual(1, t.CountOutputContaining("213")); Assert.AreEqual(1, t.CountOutputContaining("48")); Assert.AreEqual(2, t.CountOutputContaining("227")); }
public void Ex33_TestForTheOrder() { TestHelper t = new TestHelper(); t.SetupConsole(""); TestHelper.RunMain(typeof (Ex33)); t.WriteLog(); String lastLine = t.GetOutputFromLast(1); string[] parts = lastLine.Split(new char[] {' ', '\t'}); Debug.WriteLine(lastLine); Assert.AreEqual("93", parts[0]); Assert.AreEqual("89", parts[1]); Assert.AreEqual("3", parts[19]); }
public void ExB9TestWithZero() { TestHelper.TestOutputEqual(typeof(ExB9), "0\r\n", (2.40).ToString(".00")); }