public async Task MoveWithFile() { var mockDirectory1 = new MockDirectoryTreeBuilder().File("F1", "content").Object; mockDirectory1.Create(); var mockDirectory2 = new MockDirectory("c:\\Mock2"); await mockDirectory2.MoveFrom(mockDirectory1); Assert.False(mockDirectory1.File("F1").Exists()); Assert.True(mockDirectory2.File("F1").Exists()); Assert.Equal("content", mockDirectory2.File("F1").Content()); }
public async Task CopyFromFromTest() { var fs = new MockDirectory("x:\\Foo\\Bar"); var srcFile = fs.File("foo.jpg"); srcFile.Create("this is a test"); var destFile = fs.File("dest.jpg"); await(destFile.CopyFrom(srcFile, CancellationToken.None, FileAttributes.Temporary)); Assert.True(destFile.Exists()); Assert.True(srcFile.Exists()); Assert.Equal("this is a test", FileSystemHelperObjects.Content(destFile)); Assert.Equal(FileAttributes.Temporary, ((MockFile)destFile).Attributes); }
public void SisterFileText(string src, string result) { var mockDir = new MockDirectory("r:\\ss"); var srcFile = mockDir.File(src); Assert.Equal("r:\\ss\\" + result, srcFile.SisterFile(".ext").Path); }
public void GetWrappedFile() { target.File("ab.txt").Create("Foo Bar"); var file = sut.File("ab.txt"); Assert.True(file is RelativeFile); file.AssertContent("Foo Bar"); }
public void AllFilesTest(string glob, string name, bool exists) { dir.File(name).Create("Content"); Assert.Equal(exists, dir.AllFiles(glob).Any()); }