예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        public void CopyTo_NullDestFilepath()
        {
            var fileReference = new FileReference(fakeFileSystem, SOURCE_PATH);

            Assert.ThrowsAsync <ArgumentNullException>(() => fileReference.CopyToAsync(null));
        }