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()); } }
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])); }
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()); } }