示例#1
0
        public void Managed_TestWithPython()
        {
            int processID = REPLManager.Start("C:/tools/Anaconda3/python.exe", "Python");

            Assert.IsTrue(processID > 0);
            REPLManager.SetTimeout(processID, 3000);

            {
                REPLManager.WriteLine(processID, "1 + 1");
                REPLManager.WaitFor(processID, ".*");
                string outputText = REPLManager.ReadLine(processID);
                Assert.IsTrue(outputText == "2");
                REPLManager.WaitForPrompt(processID);
                string errorText = REPLManager.ReadErrorLine(processID);
                Assert.AreEqual(null, errorText);
            }

            {
                REPLManager.WriteLine(processID, "2 * 2");
                REPLManager.WaitFor(processID, ".*");
                string outputText = REPLManager.ReadLines(processID);
                Assert.IsTrue(outputText == "4");
                REPLManager.WaitForPrompt(processID);
                string errorText = REPLManager.ReadErrorLines(processID);
                Assert.AreEqual(null, errorText);
            }

            REPLManager.Stop(processID);
        }
        public void TestWithPython()
        {
            int processID = REPLManager.Start(@"C:\tools\Anaconda3\python.exe", "Python");

            Assert.IsTrue(processID > 0);
            REPLManager.SetTimeout(processID, 1000);
            REPLManager.WriteLine(processID, "1 + 1");
            string outputText = REPLManager.ReadLine(processID);

            Assert.AreEqual("2", outputText);
            REPLManager.Stop(processID);
        }