示例#1
0
        public void DoesNotOverwrite()
        {
            CopyFileProcessor processor  = new CopyFileProcessor();
            string            outputPath = GetCurrentTestResultsFilePath("out.txt");

            processor.SetParameter("NewPath", outputPath);
            processor.SetParameter("Overwrite", false);
            File.WriteAllText(outputPath, "This file will not be overwritten.");
            processor.Init(RunInfo);
            ProcessingResult result = processor.Process(GetTestFile("BasicTextFile.txt"),
                                                        MatchResultType.Yes, new string[0], new FileInfo[0], ProcessInput.OriginalFile,
                                                        CancellationToken.None);

            processor.Cleanup();
            Assert.AreEqual(ProcessingResultType.Failure, result.Type);
            Assert.AreEqual(0, result.OutputFiles.Length);
        }
示例#2
0
        public void Success()
        {
            CopyFileProcessor processor  = new CopyFileProcessor();
            string            outputPath = GetCurrentTestResultsFilePath("out.txt");

            processor.SetParameter("NewPath", outputPath);
            processor.SetParameter("Overwrite", false);
            processor.Init(RunInfo);
            ProcessingResult result = processor.Process(GetTestFile("BasicTextFile.txt"),
                                                        MatchResultType.Yes, new string[0], new FileInfo[0], ProcessInput.OriginalFile,
                                                        CancellationToken.None);

            processor.Cleanup();
            Assert.AreEqual(ProcessingResultType.Success, result.Type);
            Assert.AreEqual(1, result.OutputFiles.Length);
            Assert.AreEqual(outputPath, result.OutputFiles[0].FullName);
        }