public async Task CopyToAsync() { fakeFileSystem.AddFile(SOURCE_PATH, new MockFileData(CONTENTS)); var fileReference = new FileReference(fakeFileSystem, SOURCE_PATH); await fileReference.CopyToAsync(DEST_PATH); Assert.AreEqual(CONTENTS, fakeFileSystem.GetFile(SOURCE_PATH).TextContents); Assert.AreEqual(CONTENTS, fakeFileSystem.GetFile(DEST_PATH).TextContents); }
public async Task CopyTo_DestinationAlreadyExistsAsync() { const string DEST_CONTENTS = "dest"; fakeFileSystem.AddFile(SOURCE_PATH, new MockFileData(CONTENTS)); fakeFileSystem.AddFile(DEST_PATH, new MockFileData(DEST_CONTENTS)); var fileReference = new FileReference(fakeFileSystem, SOURCE_PATH); await fileReference.CopyToAsync(DEST_PATH); Assert.AreEqual(CONTENTS, fakeFileSystem.GetFile(SOURCE_PATH).TextContents); Assert.AreEqual(CONTENTS, fakeFileSystem.GetFile(DEST_PATH).TextContents); }
public void CopyTo_NullDestFilepath() { var fileReference = new FileReference(fakeFileSystem, SOURCE_PATH); Assert.ThrowsAsync <ArgumentNullException>(() => fileReference.CopyToAsync(null)); }