public void TestDirectoryExist() { var srcPath = @"../../../src"; var destPath = @"../../../dest"; FileIOSample.CreateDirectory(srcPath); FileIOSample.CreateDirectory(destPath); Assert.AreEqual(Directory.Exists(srcPath), true); Assert.AreEqual(Directory.Exists(destPath), true); }
public void TestFileSize() { var srcPath = @"../../../src"; var destPath = @"../../../dest"; FileIOSample.CreateDirectory(srcPath); FileIOSample.CreateDirectory(destPath); var fileName = "SampleWriteFile.TXT"; var srcFilePath = Path.Combine(srcPath, fileName); var destFilePath = Path.Combine(destPath, fileName); File.Delete(srcFilePath); File.Delete(destFilePath); FileIOSample.WriteUsingStreamWriter(srcFilePath); FileIOSample.WriteUsingStreamWriter(destFilePath); var fileInfo = new FileInfo(srcFilePath); long size = fileInfo.Length; }
public void TestFileMove() { var srcPath = @"../../../src"; var destPath = @"../../../dest"; FileIOSample.CreateDirectory(srcPath); FileIOSample.CreateDirectory(destPath); var fileName = "SampleWriteFile.TXT"; var srcFilePath = Path.Combine(srcPath, fileName); var destFilePath = Path.Combine(destPath, fileName); File.Delete(srcFilePath); File.Delete(destFilePath); FileIOSample.WriteUsingStreamWriter(srcFilePath); Assert.AreEqual(File.Exists(srcFilePath), true); File.Move(srcFilePath, destFilePath); }
public void TestLastModifiedTime() { var srcPath = @"../../../src"; var destPath = @"../../../dest"; FileIOSample.CreateDirectory(srcPath); FileIOSample.CreateDirectory(destPath); var fileName = "SampleWriteFile.TXT"; var srcFilePath = Path.Combine(srcPath, fileName); var destFilePath = Path.Combine(destPath, fileName); File.Delete(srcFilePath); File.Delete(destFilePath); FileIOSample.WriteUsingStreamWriter(srcFilePath); FileIOSample.WriteUsingStreamWriter(destFilePath); var lastWriteTime = File.GetLastWriteTime(srcFilePath); File.SetLastWriteTime(destFilePath, lastWriteTime); Assert.AreEqual(File.GetLastWriteTime(srcFilePath), File.GetLastWriteTime(destFilePath)); }