Ejemplo n.º 1
0
        public void stCopyFileTest2()
        {
            var target = new FileComponentCopyFileAccessor();

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


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


            Assert.AreEqual(Value.Empty, target.parse("[File copy.file(\"path\\subdir1\\file1.txt\", \"path2\\file2.txt\", true)]"));
            try {
                Assert.AreEqual(Value.Empty, target.parse("[File copy.file(\"path\\subdir1\\file1.txt\", \"path2\\file2.txt\", true, {\"file1.txt\"})]"));
                Assert.Fail("3");
            }
            catch (Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); }
        }
Ejemplo n.º 2
0
        public void stCopyFileTest4()
        {
            var target = new FileComponentCopyFileAccessor();

            Assert.AreEqual(Value.Empty, target.parse("[File copy.file(\"path\\subdir1\\file1.txt\", \"path2\\file2.txt\", true)]"));
            Assert.AreEqual(true, target.cmpPaths("path2", target.destDir));
            Assert.AreEqual(true, target.cmpPaths("file2.txt", target.destFile));
            Assert.AreEqual(true, target.overwrite);
            Assert.AreEqual(1, target.files.Length);
            Assert.AreEqual(true, target.cmpPaths("path\\subdir1\\file1.txt", target.files[0]));
        }
Ejemplo n.º 3
0
        public void stCopyFileTest4()
        {
            var target = new FileComponentCopyFileAccessor();

            Assert.AreEqual(Value.Empty, target.parse("[File copy.file(\"path\\subdir1\\file1.txt\", \"path2\\file2.txt\", true)]"));
            Assert.AreEqual(true, target.cmpPaths("path2", target.destDir));
            Assert.AreEqual(true, target.cmpPaths("file2.txt", target.destFile));
            Assert.AreEqual(true, target.overwrite);
            Assert.AreEqual(1, target.files.Length);
            Assert.AreEqual(true, target.cmpPaths("path\\subdir1\\file1.txt", target.files[0]));
        }
Ejemplo n.º 4
0
        public void stCopyFileTest2()
        {
            var target = new FileComponentCopyFileAccessor();

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

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

            Assert.AreEqual(Value.Empty, target.parse("[File copy.file(\"path\\subdir1\\file1.txt\", \"path2\\file2.txt\", true)]"));
            try {
                Assert.AreEqual(Value.Empty, target.parse("[File copy.file(\"path\\subdir1\\file1.txt\", \"path2\\file2.txt\", true, {\"file1.txt\"})]"));
                Assert.Fail("3");
            }
            catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); }
        }