public FileSystemHarness WithSampleFile() { if (File.Exists(SampleFile)) { File.Delete(SampleFile); } File.WriteAllText(SampleFile, $"{Now} This is some some sample text in sample file."); SourceFolderSnap = new FolderSnapshot(Path.GetDirectoryName(SampleFile)); return(this); }
public FileSystemHarness WithTargetFile() { if (File.Exists(TargetFile)) { File.Delete(TargetFile); } File.WriteAllText(TargetFile, $"{Now} This is some some sample text in target file."); TargetFolderSnap = new FolderSnapshot(Path.GetDirectoryName(TargetFile)); return(this); }
public FileSystemHarness(MethodBase testMethod) { TestFixture = testMethod.ReflectedType.Name; TestName = testMethod.Name; BaseTest.EnsureFolders(TestFixture, TestName); BaseTest.ClearFolders(TestFixture, TestName); Now = DateTime.Now; Suffix = $"\\SampleFile-{Now.ToString("yyyy-MM-dd-HH-mm-ss")}.txt"; SampleFile = $"{BaseTest.SourceFolder(TestFixture, TestName)}{Suffix}"; TargetFile = $"{BaseTest.TargetFolder(TestFixture, TestName)}{Suffix}"; SourceFolderSnap = new FolderSnapshot(Path.GetDirectoryName(SampleFile)); TargetFolderSnap = new FolderSnapshot(Path.GetDirectoryName(TargetFile)); FileSystem = new FileSystem(); }