static void Main(string[] args) { try { // Open the text file using a stream reader. StreamReader sr = new StreamReader("C:\\Users\\Andrew\\Documents\\GitHub\\CIS297\\bettingSimulator\\476Project1\\476Project1\\testSchedule.txt"); // Read the stream to a string, and write the string to the console. String line = sr.ReadLine(); while (line != null) { test = factory.createTest(line); if (test != null) { testButton(test); testWindow(test); testTextbox(test); } line = sr.ReadLine(); } } catch (Exception e) { Console.WriteLine("The file could not be read:"); Console.WriteLine(e.Message); } }
public TestVersion createTest(string test) { TestVersion temp = null; try { if (test == "Word90") { temp = Test90.initialize(); } else if (test == "Word00") { temp = Test00.initialize(); } else if (test == "Word10") { temp = Test10.initialize(); } else if (test == "Word17") { temp = Test17.initialize(); } else { temp = null; throw new ArgumentException("Invalid version value."); } if (temp == null) { throw new AccessViolationException($"Two members of the {test} item have already been tested."); } } catch (ArgumentException e) { Console.WriteLine(e.Message); } catch (AccessViolationException e) { Console.WriteLine(e.Message); } return(temp); }
public static void testTextbox(TestVersion test) { Console.WriteLine(test.getTextbox()); }
public static void testWindow(TestVersion test) { Console.WriteLine(test.getWindow()); }
public static void testButton(TestVersion test) { Console.WriteLine(test.getButton()); }