public void ExportNonExistingQueryTest() { AvrAccessExportResult result = AccessExporter.ExportX86(1, "en", GetTempFilePath()); Assert.IsNotNull(result); Assert.IsFalse(result.IsOk); }
public void InternalExportTest() { Assert.IsTrue(File.Exists(m_ExportUtilFilePath)); // Start the child process. var process = new Process { StartInfo = { // Redirect the output stream of the child process. UseShellExecute = false, RedirectStandardOutput = true, FileName = m_ExportUtilFilePath, }, }; process.Start(); // Read the output stream first and then wait for the child process to exit string output = process.StandardOutput.ReadToEnd(); Assert.IsNotNull(output); AvrAccessExportResult result = AvrAccessExportResult.Deserialize(output); Assert.IsNotNull(result); process.WaitForExit(); }
private static void Main(string[] args) { try { Init(); AvrAccessExportResult result = ParceArgs(args); if (result.IsOk) { var exportedMessage = ExportToAccess(result); if (!string.IsNullOrEmpty(exportedMessage)) { result = new AvrAccessExportResult(exportedMessage); } } Console.WriteLine(result.Serialize()); } catch (Exception ex) { var result = new AvrAccessExportResult("Export error", ex.ToString()); Console.WriteLine(result.Serialize()); } //Console.ReadLine(); Environment.Exit(0); }
public void ExportFailsX64Test() { AvrAccessExportResult result = AccessExporter.ExportX64(HumanQueryId, "en", GetTempFilePath()); Assert.IsNotNull(result); Console.WriteLine(result.ExceptionString); Assert.IsFalse(result.IsOk); }
public void ExportSuccessRuX86Test() { AvrAccessExportResult result = AccessExporter.ExportX86(HumanQueryId, "ru", GetTempFilePath()); Assert.IsNotNull(result); Console.WriteLine(result.ExceptionString); Assert.IsTrue(result.IsOk); }
private static string ExportToAccess(AvrAccessExportResult result) { //using (new CultureInfoTransaction(new CultureInfo(CustomCultureHelper.SupportedLanguages[lang]))) ModelUserContext.CurrentLanguage = result.Language; CachedQueryResult queryResult = ServiceClientHelper.ExecQuery(result.QueryId, false, string.Empty, true); if (string.IsNullOrEmpty(queryResult.ErrorMessage)) { AccessDataAdapter.QueryLineListToAccess(result.ResultFilePath, queryResult.QueryTable); } return(queryResult.ErrorMessage); }
public void ErrorAccessResultSerializeTest() { var source = new AvrAccessExportResult("xxx", new InvalidOperationException("yyy").ToString()); string xml = source.Serialize(); AvrAccessExportResult result = AvrAccessExportResult.Deserialize(xml); Assert.IsNotNull(result); Assert.IsFalse(result.IsOk); Assert.AreEqual("xxx", result.ErrorMessage); Assert.IsTrue(string.IsNullOrEmpty(result.ResultFilePath)); Assert.AreEqual(source.ExceptionString, result.ExceptionString); string resultXml = result.Serialize(); Assert.IsNotNull(resultXml); Assert.AreEqual(xml, resultXml); }
public void SuccessAccessResultSerializeTest() { var source = new AvrAccessExportResult(1, "en", "xxx"); string xml = source.Serialize(); AvrAccessExportResult result = AvrAccessExportResult.Deserialize(xml); Assert.IsNotNull(result); Assert.IsTrue(result.IsOk); Assert.AreEqual("xxx", result.ResultFilePath); Assert.AreEqual(1, result.QueryId); Assert.IsTrue(string.IsNullOrEmpty(result.ErrorMessage)); Assert.IsTrue(string.IsNullOrEmpty(result.ExceptionString)); string resultXml = result.Serialize(); Assert.IsNotNull(resultXml); Assert.AreEqual(xml, resultXml); }