Exemplo n.º 1
0
        public void TestReadFile()
        {
            var fs = new PlotLingoLib.Expressions.FunctionExpression("readfile", new StringValue("TestReadFile.txt"));
            var c  = new RootContext();
            var r  = fs.Evaluate(c);

            Assert.AreEqual("hi\r\nthere", r, "content of file");
        }
Exemplo n.º 2
0
        public void ReadFromFileNearPlotLingoScript()
        {
            if (Directory.Exists("ReadFromScriptFile"))
            {
                Directory.Delete("ReadFromScriptFile", true);
            }

            var dirinfo = Directory.CreateDirectory("ReadFromScriptFile");

            File.Copy("TestReadFile.txt", @"ReadFromScriptFile\read.txt");
            var fs = new PlotLingoLib.Expressions.FunctionExpression("readfile", new StringValue("read.txt"));
            var c  = new RootContext();

            c.ExecutionContext.ScriptFileContextPush(new FileInfo(string.Format(@"{0}\bogus.plotlingo", dirinfo.FullName)));
            var r = fs.Evaluate(c);

            Assert.AreEqual("hi\r\nthere", r, "content of file");
        }