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(); }
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); }