示例#1
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()); }
        }
示例#2
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()); }
        }
示例#3
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()); }
        }
示例#4
0
 public void parseTest2()
 {
     FileComponent target = new FileComponent();
     target.parse("File get(\"file\")");
 }
示例#5
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()); }
        }
示例#6
0
 public void stGetParseTest1()
 {
     FileComponent target = new FileComponent();
     target.parse("[File get(file)]");
 }
示例#7
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()); }
        }
示例#8
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));
            }
        }
示例#9
0
        public void stCopyFileTest1()
        {
            var target = new FileComponent();

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

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

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

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