コード例 #1
0
        public void GivenFilePattern__WhenCallingRun__ShouldOnlyCopyFilesMatchingPattern()
        {
            const string sourceDir  = "Data";
            const string firstFile  = "Data/MyFile.txt";
            const string secondFile = "Data/MySecondFile.txt";
            const string thirdFile  = "Data/MyThirdFile.cpp";

            const string destDir        = "Copy";
            const string firstDestFile  = "Copy/MyFile.txt";
            const string secondDestFile = "Copy/MySecondFile.txt";
            const string thirdDestFile  = "Copy/MyThirdFile.cpp";

            AddFile(firstFile, "content");
            AddFile(secondFile, "content");
            AddFile(thirdFile, "content");

            _sut.Source      = sourceDir;
            _sut.Destination = destDir;
            _sut.FilePattern = "*.txt";

            _sut.Run();


            _assertions.AssertFileExists(firstDestFile);
            _assertions.AssertFileExists(secondDestFile);

            _assertions.AssertFileDoesNotExist(thirdDestFile);
        }
コード例 #2
0
        public void GivenPathToFile__WhenCallingRun__ShouldDeleteFile()
        {
            const string dirPath  = "Data";
            const string filePath = "Data/MyFile.txt";

            _fileSystem.AddDirectory(dirPath);
            _fileSystem.AddFile(filePath, new MockFileData(string.Empty));

            _sut.Path = filePath;

            _sut.Run();

            _assertions.AssertFileDoesNotExist(filePath);
        }