Example #1
0
        public void stDeleteTest1()
        {
            var target = new FileComponent();

            try {
                target.parse("[File delete]");
                Assert.Fail("1");
            }
            catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); }

            try {
                target.parse("[File delete.files]");
                Assert.Fail("2");
            }
            catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); }

            try {
                target.parse("[File delete.directory]");
                Assert.Fail("3");
            }
            catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); }

            try {
                target.parse("[File delete.notRalNode]");
                Assert.Fail("4");
            }
            catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); }
        }
Example #2
0
        public void stDeleteFilesTest1()
        {
            var target = new FileComponent();

            try {
                target.parse("[File delete.files(\"file\")]");
                Assert.Fail("1");
            }
            catch (Exception ex) {
                Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException));
            }

            try {
                target.parse("[File delete.files({\"file\", false})]");
                Assert.Fail("2");
            }
            catch (Exception ex) {
                Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException));
            }

            try {
                target.parse("[File delete.files({\"file\"}, {true})]");
                Assert.Fail("3");
            }
            catch (Exception ex) {
                Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException));
            }
        }
Example #3
0
        public void stCopyDirectoryTest1()
        {
            var target = new FileComponent();

            try {
                target.parse("[File copy.directory()]");
                Assert.Fail("1");
            }
            catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException), ex.GetType().ToString()); }

            try {
                target.parse("[File copy.directory(false)]");
                Assert.Fail("2");
            }
            catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException), ex.GetType().ToString()); }

            try {
                target.parse("[File copy.directory(\" \", \"dest\", false)]");
                Assert.Fail("3");
            }
            catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); }

            try {
                target.parse("[File copy.directory(\"src\", \" \", false)]");
                Assert.Fail("4");
            }
            catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); }
        }
Example #4
0
        public void stRemoteTest1()
        {
            var target = new FileComponent();

            try {
                target.parse("[File remote]");
                Assert.Fail("1");
            }
            catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); }

            try {
                target.parse("[File remote.download]");
                Assert.Fail("2");
            }
            catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); }

            try {
                target.parse("[File remote.notRealNode]");
                Assert.Fail("3");
            }
            catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); }

            try {
                target.parse("[File remote.download(\"addr\", \"file\").notRealNode]");
                Assert.Fail("4");
            }
            catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(NotSupportedOperationException), ex.GetType().ToString()); }
        }
Example #5
0
        public void stCallParseTest1()
        {
            var target = new FileComponent();

            try {
                target.parse("[File call(file)]");
                Assert.Fail("1");
            }
            catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException), ex.GetType().ToString()); }

            try {
                target.parse("[File out(file)]");
                Assert.Fail("2");
            }
            catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException), ex.GetType().ToString()); }
        }
Example #6
0
        public void stRemoteTest2()
        {
            var target = new FileComponent();

            try {
                target.parse("[File remote.download()]");
                Assert.Fail("1");
            }
            catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException), ex.GetType().ToString()); }

            try {
                target.parse("[File remote.download(\"addr\")]");
                Assert.Fail("2");
            }
            catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException), ex.GetType().ToString()); }

            try {
                target.parse("[File remote.download(\"addr\", \"file\", \"user\")]");
                Assert.Fail("3");
            }
            catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException), ex.GetType().ToString()); }
        }
Example #7
0
        public void stWriteParseTest5()
        {
            var target = new FileComponent();

            try {
                target.parse("[File write(\"file\", true):data]");
                Assert.Fail("1");
            }
            catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException), ex.GetType().ToString()); }

            try {
                target.parse("[File write(\"file\", true, true):data]");
                Assert.Fail("2");
            }
            catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException), ex.GetType().ToString()); }

            try {
                target.parse("[File write(\"file\", \"true\", \"true\", \"utf-8\"):data]");
                Assert.Fail("3");
            }
            catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException), ex.GetType().ToString()); }

            try {
                target.parse("[File append(\"file\", true, true, \"utf-8\"):data]");
                Assert.Fail("4");
            }
            catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException), ex.GetType().ToString()); }

            try {
                target.parse("[File appendLine(\"file\", true, true, \"utf-8\"):data]");
                Assert.Fail("5");
            }
            catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException), ex.GetType().ToString()); }

            try {
                target.parse("[File writeLine(\"file\", true, true, \"utf-8\"):data]");
                Assert.Fail("6");
            }
            catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException), ex.GetType().ToString()); }
        }
Example #8
0
        public void stGetParseTest1()
        {
            FileComponent target = new FileComponent();

            target.parse("[File get(file)]");
        }
Example #9
0
        public void parseTest2()
        {
            FileComponent target = new FileComponent();

            target.parse("File get(\"file\")");
        }