public void File_ReadText() { const string contents = "test"; var fn = GetNewFileNameOnTempPath(".txt"); System.IO.File.WriteAllText(fn, contents); var fnInfo = FileSystem.FileFromPath(fn); Assert.AreEqual(contents, FileSystem.ReadText(fnInfo)); }
public void File_Move() { const string contents = "test"; var fn = GetNewFileNameOnTempPath(".txt"); System.IO.File.WriteAllText(fn, contents); Assert.IsTrue(System.IO.File.Exists(fn)); var dest = GetNewFileNameOnTempPath(".txt"); var destInfo = FileSystem.FileFromPath(dest); FileSystem.MoveFile(fn, dest); Assert.IsTrue(System.IO.File.Exists(dest)); Assert.IsFalse(System.IO.File.Exists(fn)); Assert.AreEqual(contents, FileSystem.ReadText(destInfo)); }
public void Directory_Copy() { var tmpSrc = GetNewFileNameOnTempPath(""); var tmpSrcInfo = FileSystem.DirectoryFromPath(tmpSrc); const string fileName = @"temp.txt"; FileSystem.WriteText(FileSystem.CombinePath(tmpSrc, fileName), "test"); var tmpDest = GetNewFileNameOnTempPath(""); FileSystem.CopyDirectory(tmpSrcInfo, tmpDest); Assert.IsTrue(FileSystem.DirectoryExists(tmpSrc)); Assert.IsTrue(FileSystem.DirectoryExists(tmpDest)); var destFileName = FileSystem.CombinePath(tmpDest, fileName); Assert.IsTrue(FileSystem.FileExists(destFileName)); Assert.AreEqual("test", FileSystem.ReadText(FileSystem.FileFromPath(destFileName))); }