public void TestRunDownloadScript() { using (StringWriter sw = new StringWriter()) { Console.SetOut(sw); string[] updateResult = LoadXML.RunDownloadScript(); string[] makePrettyResult = LoadXML.RunDownloadScript(function: LoadXML.Functions.MAKE_PRETTY_XML); List <string> filePaths = new List <string>(updateResult.Concat(makePrettyResult)); foreach (string s in filePaths) { Assert.IsTrue(File.Exists(s.Trim('\"')), s.Trim('\"')); } List <string> expected = sw.ToString().Split('\n').ToList <string>(); #region Assertions Assert.AreEqual("UPDATE_XML\r", expected[0]); Assert.AreEqual("Selected file:" + "\"" + updateResult[0] + "\"" + "\r", expected[1]); Assert.AreEqual("Downloading data from Lotto.pl server. Progress:\r", (expected[3])); Assert.AreEqual("********************************************************************************\r", (expected[4])); Assert.IsTrue(expected[5].Contains("Processed") & expected[5].Contains("days")); Assert.AreEqual("Function UPDATE_XML has finished", expected[expected.Count - 10]); Assert.AreEqual("MAKE_PRETTY_XML\r", expected[expected.Count - 8]); Assert.AreEqual("File has been formated.\r", expected[expected.Count - 5]); Assert.AreEqual("Function MAKE_PRETTY_XML has finished", expected[expected.Count - 3]); #endregion } }
static void Main(string[] args) { //LoadXML.RunDownloadScript(function : LoadXML.Functions.UPDATE_XML); //LoadXML.RunDownloadScript(function: LoadXML.Functions.MAKE_PRETTY_XML); //ExportDrawsToSQL exportToSQL = new ExportDrawsToSQL(new SQLUtils.ConnectionString(@"(localdb)\MSSQLLocalDB", "Lotto", true, "RawData")); //exportToSQL.ExportDrawsListToSQL(LoadXML.DeserializeXML()); //bool c = SQLQueries.procedure_ValidateDatabaseRowNumbers(new SQLUtils.ConnectionString(@"(localdb)\MSSQLLocalDB", "Lotto", true, "RawData").ToString()); LoadXML.RunDownloadScript(); Console.WriteLine("Done"); Console.ReadKey(); }