当前位置: 首页>>代码示例>>C#>>正文


C# MockReplWindow.ClearScreen方法代码示例

本文整理汇总了C#中TestUtilities.Mocks.MockReplWindow.ClearScreen方法的典型用法代码示例。如果您正苦于以下问题:C# MockReplWindow.ClearScreen方法的具体用法?C# MockReplWindow.ClearScreen怎么用?C# MockReplWindow.ClearScreen使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TestUtilities.Mocks.MockReplWindow的用法示例。


在下文中一共展示了MockReplWindow.ClearScreen方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: IronPythonModuleName

 public void IronPythonModuleName() {
     var replEval = new PythonReplEvaluator(IronPythonInterpreter, PythonToolsTestUtilities.CreateMockServiceProvider(), new ReplTestReplOptions());
     var replWindow = new MockReplWindow(replEval);
     replEval._Initialize(replWindow).Wait();
     replWindow.ClearScreen();
     var execute = replEval.ExecuteText("__name__");
     execute.Wait();
     Assert.IsTrue(execute.Result.IsSuccessful);
     Assert.AreEqual(replWindow.Output, "'__main__'\r\n");
     replWindow.ClearScreen();
 }
开发者ID:wenh123,项目名称:PTVS,代码行数:11,代码来源:ReplEvaluatorTests.cs

示例2: IronPythonModuleName

 public void IronPythonModuleName() {
     using (var replEval = Evaluator) {
         var replWindow = new MockReplWindow(replEval);
         replEval._Initialize(replWindow).Wait();
         replWindow.ClearScreen();
         var execute = replEval.ExecuteText("__name__");
         execute.Wait();
         Assert.IsTrue(execute.Result.IsSuccessful);
         Assert.AreEqual(replWindow.Output, "'__main__'\n");
         replWindow.ClearScreen();
     }
 }
开发者ID:jsschultz,项目名称:PTVS,代码行数:12,代码来源:ReplEvaluatorTests.cs

示例3: TestNumber

 public void TestNumber() {
     using (var eval = ProjectlessEvaluator()) {
         var window = new MockReplWindow(eval);
         window.ClearScreen();
         var res = eval.ExecuteText("42");
         Assert.IsTrue(res.Wait(10000));
         Assert.AreEqual(window.Output, "42");
     }
 }
开发者ID:mauricionr,项目名称:nodejstools,代码行数:9,代码来源:ReplWindowTests.cs

示例4: TestRequire

 public void TestRequire() {
     using (var eval = ProjectlessEvaluator()) {
         var window = new MockReplWindow(eval);
         window.ClearScreen();
         var res = eval.ExecuteText("require('http').constructor");
         Assert.IsTrue(res.Wait(10000));
         Assert.AreEqual("[Function: Object]", window.Output);
     }
 }
开发者ID:mauricionr,项目名称:nodejstools,代码行数:9,代码来源:ReplWindowTests.cs

示例5: TestFunctionDefinition

        public void TestFunctionDefinition() {
            var whitespaces = new[] { "", "\r\n", "   ", "\r\n    " };
            using (var eval = ProjectlessEvaluator()) {
                foreach (var whitespace in whitespaces) {
                    Console.WriteLine("Whitespace: {0}", whitespace);
                    var window = new MockReplWindow(eval);
                    window.ClearScreen();
                    var res = eval.ExecuteText(whitespace + "function f() { }");
                    Assert.IsTrue(res.Wait(10000));
                    Assert.AreEqual("undefined", window.Output);
                    window.ClearScreen();

                    res = eval.ExecuteText("f");
                    Assert.IsTrue(res.Wait(10000));
                    Assert.AreEqual("[Function: f]", window.Output);
                }
            }
        }
开发者ID:mauricionr,项目名称:nodejstools,代码行数:18,代码来源:ReplWindowTests.cs

示例6: TestSave

        public void TestSave() {
            using (var eval = ProjectlessEvaluator()) {
                var window = new MockReplWindow(eval, NodejsConstants.JavaScript);
                window.ClearScreen();
                var res = window.Execute("function f() { }");

                Assert.IsTrue(res.Wait(10000));

                res = window.Execute("function g() { }");
                Assert.IsTrue(res.Wait(10000));

                var path = Path.GetTempFileName();
                File.Delete(path);
                new SaveReplCommand().Execute(window, path).Wait(10000);

                Assert.IsTrue(File.Exists(path));
                var saved = File.ReadAllText(path);

                Assert.IsTrue(saved.IndexOf("function f") != -1);
                Assert.IsTrue(saved.IndexOf("function g") != -1);

                Assert.IsTrue(window.Output.Contains("Session saved to:"));
            }
        }
开发者ID:mauricionr,项目名称:nodejstools,代码行数:24,代码来源:ReplWindowTests.cs

示例7: TestSaveBadFile

        public void TestSaveBadFile() {
            using (var eval = ProjectlessEvaluator()) {
                var window = new MockReplWindow(eval);
                window.ClearScreen();
                var res = eval.ExecuteText("function f() { }");

                Assert.IsTrue(res.Wait(10000));

                res = eval.ExecuteText("function g() { }");
                Assert.IsTrue(res.Wait(10000));

                new SaveReplCommand().Execute(window, "<foo>").Wait(10000);

                Assert.IsTrue(window.Error.Contains("Invalid filename: <foo>"));
            }
        }
开发者ID:mauricionr,项目名称:nodejstools,代码行数:16,代码来源:ReplWindowTests.cs

示例8: TestReset

        public void TestReset() {
            using (var eval = ProjectlessEvaluator()) {
                var window = new MockReplWindow(eval);
                window.ClearScreen();

                var res = eval.ExecuteText("1");
                Assert.IsTrue(res.Wait(10000));
                Assert.AreEqual("1", window.Output);
                res = window.Reset();
                Assert.IsTrue(res.Wait(10000));

                Assert.AreEqual("The process has exited" + Environment.NewLine, window.Error);
                window.ClearScreen();
                Assert.AreEqual("", window.Output);
                Assert.AreEqual("", window.Error);

                //Check to ensure the REPL continues to work after Reset
                res = eval.ExecuteText("var a = 1");
                Assert.IsTrue(res.Wait(10000));
                Assert.AreEqual("undefined", window.Output);
                res = eval.ExecuteText("a");
                Assert.IsTrue(res.Wait(10000));
                Assert.AreEqual("undefined1", window.Output);
            }
        }
开发者ID:mauricionr,项目名称:nodejstools,代码行数:25,代码来源:ReplWindowTests.cs

示例9: TestProcessExit

        public void TestProcessExit() {
            using (var eval = ProjectlessEvaluator()) {
                var window = new MockReplWindow(eval);
                window.ClearScreen();
                var res = eval.ExecuteText("process.exit(0);");

                Assert.IsTrue(res.Wait(10000));

                Assert.AreEqual("The process has exited" + Environment.NewLine, window.Error);
                window.ClearScreen();

                res = eval.ExecuteText("42");
                Assert.IsTrue(res.Wait(10000));
                Assert.AreEqual("Current interactive window is disconnected - please reset the process.\r\n", window.Error);
            }
        }
开发者ID:mauricionr,项目名称:nodejstools,代码行数:16,代码来源:ReplWindowTests.cs

示例10: AttachSupportMultiThreaded

        public void AttachSupportMultiThreaded() {
            // http://pytools.codeplex.com/workitem/663
            using (var replEval = Evaluator) {
                var replWindow = new MockReplWindow(replEval);
                replEval._Initialize(replWindow).Wait();
                var code = new[] {
                    "import threading",
                    "def sayHello():\r\n    pass",
                    "t1 = threading.Thread(target=sayHello)",
                    "t1.start()",
                    "t2 = threading.Thread(target=sayHello)",
                    "t2.start()"
                };
                foreach (var line in code) {
                    var execute = replEval.ExecuteText(line);
                    execute.Wait();
                    Assert.IsTrue(execute.Result.IsSuccessful);
                }

                replWindow.ClearScreen();
                var finalExecute = replEval.ExecuteText("42");
                finalExecute.Wait();
                Assert.IsTrue(finalExecute.Result.IsSuccessful);
                Assert.AreEqual(replWindow.Output, "42\n");
            }
        }
开发者ID:jsschultz,项目名称:PTVS,代码行数:26,代码来源:ReplEvaluatorTests.cs

示例11: ConsoleWriteLineTest

        public void ConsoleWriteLineTest() {
            // http://pytools.codeplex.com/workitem/649
            var replEval = new PythonReplEvaluator(IronPythonInterpreter, PythonToolsTestUtilities.CreateMockServiceProvider(), new ReplTestReplOptions());
            var replWindow = new MockReplWindow(replEval);
            replEval._Initialize(replWindow).Wait();
            var execute = replEval.ExecuteText("import System");
            execute.Wait();
            Assert.IsTrue(execute.Result.IsSuccessful);
            replWindow.ClearScreen();

            execute = replEval.ExecuteText("System.Console.WriteLine(42)");
            execute.Wait();
            Assert.AreEqual(replWindow.Output, "42\r\n");
            replWindow.ClearScreen();

            Assert.IsTrue(execute.Result.IsSuccessful);

            execute = replEval.ExecuteText("System.Console.Write(42)");
            execute.Wait();

            Assert.IsTrue(execute.Result.IsSuccessful);

            Assert.AreEqual(replWindow.Output, "42");
        }
开发者ID:wenh123,项目名称:PTVS,代码行数:24,代码来源:ReplEvaluatorTests.cs

示例12: TestObjectLiteral

 public void TestObjectLiteral() {
     using (var eval = ProjectlessEvaluator()) {
         var window = new MockReplWindow(eval);
         window.ClearScreen();
         var res = eval.ExecuteText("{x:42}");
         Assert.IsTrue(res.Wait(10000));
         Assert.AreEqual("{ x: 42 }", window.Output);
     }
 }
开发者ID:mauricionr,项目名称:nodejstools,代码行数:9,代码来源:ReplWindowTests.cs

示例13: TestRequireInProject

        public void TestRequireInProject() {
            string testDir;
            do {
                testDir = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
            } while (Directory.Exists(testDir));
            Directory.CreateDirectory(testDir);
            var moduleDir = Path.Combine(testDir, "node_modules");
            Directory.CreateDirectory(moduleDir);
            File.WriteAllText(Path.Combine(moduleDir, "foo.js"), "exports.foo = function(a, b, c) { }");
            File.WriteAllText(Path.Combine(testDir, "bar.js"), "exports.bar = function(a, b, c) { }");

            try {
                using (var eval = new NodejsReplEvaluator(new TestNodejsReplSite(null, testDir))) {
                    var window = new MockReplWindow(eval);
                    window.ClearScreen();
                    var res = eval.ExecuteText("require('foo.js');");
                    Assert.IsTrue(res.Wait(10000));
                    Assert.AreEqual(window.Output, "{ foo: [Function] }");
                    window.ClearScreen();

                    res = eval.ExecuteText("require('./bar.js');");
                    Assert.IsTrue(res.Wait(10000));
                    Assert.AreEqual(window.Output, "{ bar: [Function] }");
                }
            } finally {
                try {
                    Directory.Delete(testDir, true);
                } catch (IOException) {
                }
            }
        }
开发者ID:mauricionr,项目名称:nodejstools,代码行数:31,代码来源:ReplWindowTests.cs

示例14: ConsoleWriteLineTest

        public void ConsoleWriteLineTest() {
            // http://pytools.codeplex.com/workitem/649
            using (var replEval = Evaluator) {
                var replWindow = new MockReplWindow(replEval);
                replEval._Initialize(replWindow).Wait();
                var execute = replEval.ExecuteText("import System");
                execute.Wait();
                Assert.IsTrue(execute.Result.IsSuccessful);
                replWindow.ClearScreen();

                execute = replEval.ExecuteText("System.Console.WriteLine(42)");
                execute.Wait();
                Assert.AreEqual(replWindow.Output, "42\n");
                replWindow.ClearScreen();

                Assert.IsTrue(execute.Result.IsSuccessful);

                execute = replEval.ExecuteText("System.Console.Write(42)");
                execute.Wait();

                Assert.IsTrue(execute.Result.IsSuccessful);

                Assert.AreEqual(replWindow.Output, "42");
            }
        }
开发者ID:jsschultz,项目名称:PTVS,代码行数:25,代码来源:ReplEvaluatorTests.cs

示例15: AttachSupportMultiThreaded

        public void AttachSupportMultiThreaded() {
            // http://pytools.codeplex.com/workitem/663
            var replEval = new PythonReplEvaluator(IronPythonInterpreter, PythonToolsTestUtilities.CreateMockServiceProvider(), new ReplTestReplOptions());
            var replWindow = new MockReplWindow(replEval);
            replEval._Initialize(replWindow).Wait();
            var code = new[] {
                "import threading",
                "def sayHello():\r\n    pass",
                "t1 = threading.Thread(target=sayHello)",
                "t1.start()",
                "t2 = threading.Thread(target=sayHello)",
                "t2.start()"
            };
            foreach (var line in code) {
                var execute = replEval.ExecuteText(line);
                execute.Wait();
                Assert.IsTrue(execute.Result.IsSuccessful);
            }

            replWindow.ClearScreen();
            var finalExecute = replEval.ExecuteText("42");
            finalExecute.Wait();
            Assert.IsTrue(finalExecute.Result.IsSuccessful);
            Assert.AreEqual(replWindow.Output, "42\r\n");
        }
开发者ID:wenh123,项目名称:PTVS,代码行数:25,代码来源:ReplEvaluatorTests.cs


注:本文中的TestUtilities.Mocks.MockReplWindow.ClearScreen方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。