From 47d845e70fb3bb27d27998aa45cce8807149272e Mon Sep 17 00:00:00 2001 From: John Andrews Date: Sat, 21 May 2022 21:13:19 +1200 Subject: [PATCH] added copy file tests --- BasicNodes/File/CopyFile.cs | 1 + BasicNodes/Tests/CopyTests.cs | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 BasicNodes/Tests/CopyTests.cs diff --git a/BasicNodes/File/CopyFile.cs b/BasicNodes/File/CopyFile.cs index 5b7b61ea..213a36bf 100644 --- a/BasicNodes/File/CopyFile.cs +++ b/BasicNodes/File/CopyFile.cs @@ -88,6 +88,7 @@ namespace FileFlows.BasicNodes.File args.Logger.ILog($"CopyFile.Dest[6] '{dest}'"); args.Logger.ILog($"CopyFileArgs: '{args.WorkingFile}', '{dest}'"); + bool copied = args.CopyFile(args.WorkingFile, dest, updateWorkingFile: true); if (!copied) return -1; diff --git a/BasicNodes/Tests/CopyTests.cs b/BasicNodes/Tests/CopyTests.cs new file mode 100644 index 00000000..eace809f --- /dev/null +++ b/BasicNodes/Tests/CopyTests.cs @@ -0,0 +1,31 @@ +using FileFlows.Plugin; + +#if(DEBUG) + +namespace BasicNodes.Tests; + +using FileFlows.BasicNodes.File; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +[TestClass] +public class CopyTests +{ + + [TestMethod] + public void CopyTests_Dir_Mapping() + { + var logger = new TestLogger(); + var args = new FileFlows.Plugin.NodeParameters(@"c:\test\testfile.mkv", logger, false, string.Empty); + args.PathMapper = s => s; + + CopyFile node = new (); + node.CopyFolder = true; + node.DestinationPath = "/mnt/tempNAS/media/dvd/output"; + node.DestinationFile = "{file.Orig.FileName}p.DVD.x264.slow.CRF16{ext}"; + var result = node.Execute(args); + Assert.AreEqual(2, result); + } + +} + +#endif \ No newline at end of file