Exemple #1
0
        public void TestFileExists()
        {
            var fileName         = "foo.txt";
            var filePath         = Path.Combine("%temp%", fileName);
            var absoluteFilePath = Path.Combine(Path.GetTempPath(), fileName);

            _node.FileExists(filePath).Should().BeFalse();
            _node.FileExists(absoluteFilePath).Should().BeFalse();

            _fileSystem.DirectoryExists(Path.GetTempPath());
            _fileSystem.WriteAllText(Path.Combine(Path.GetTempPath(), fileName), "Whasup");
            _node.FileExists(filePath).Should().BeTrue();
            _node.FileExists(absoluteFilePath).Should().BeTrue();

            _fileSystem.DeleteFile(Path.Combine(Path.GetTempPath(), fileName));
            _node.FileExists(filePath).Should().BeFalse();
            _node.FileExists(absoluteFilePath).Should().BeFalse();
        }