// Start function called from the harness core public void run() { // Setup Console.Write("Instantiating instance of ASComicAccess.xkcd... "); ASComicAccess.xkcd testClass = new ASComicAccess.xkcd(); Console.WriteLine("Done.\n"); // Test of the get-latest function Console.Write("Testing latest comic function... "); if (testLatestComic(testClass)) { // Note: All this guff isn't technically neccessary, but it's personal preference Console.Write("["); Console.ForegroundColor = ConsoleColor.DarkGreen; // GREEN pass text Console.Write("PASS"); Console.ResetColor(); // Back to normal colour Console.WriteLine("]"); Console.WriteLine("TEST OUTPUT:"); Console.WriteLine(output); } else { Console.Write("["); Console.ForegroundColor = ConsoleColor.DarkRed; // RED fail text Console.Write("FAIL"); Console.ResetColor(); // Back to normal colour Console.WriteLine("]"); } // Test of get-by-ID function int startID = 612; int endID = 618; Console.WriteLine("Testing comic by ID function with IDs " + startID.ToString() + " to " + endID.ToString() +"... "); for (int i = startID; i <= endID; i++) { Console.Write("\nTesting with ID " + i.ToString() + "... "); if (testComicByID(testClass, i)) { // Note: All this guff isn't technically neccessary, but it's personal preference Console.Write("["); Console.ForegroundColor = ConsoleColor.DarkGreen; // GREEN pass text Console.Write("PASS"); Console.ResetColor(); // Back to normal colour Console.WriteLine("]"); Console.WriteLine("TEST OUTPUT:"); Console.WriteLine(output); } else { Console.Write("["); Console.ForegroundColor = ConsoleColor.DarkRed; // RED fail text Console.Write("FAIL"); Console.ResetColor(); // Back to normal colour Console.WriteLine("]"); } } }
// Initializer (yes yes, US spelling. Programming convention. I swear.) internal ViewerCore() { // Setup ASLibs components dbEngine = new ASComicDatabase(Environment.ExpandEnvironmentVariables("%HOMEDRIVE%%HOMEPATH%") + "\\AppData\\Roaming\\xkcd Viewer\\xkcd.sdf"); accessEngine = new ASComicAccess.xkcd(); }