Exemplo n.º 1
0
        public void CopyTo_HttpRequestException()
        {
            fakeHttpMessageHandler.ExceptionMap[new Uri(SOURCE_URL)] = new HttpRequestException();
            fakeFileSystem.AddFile(DEST_PATH, new MockFileData(CONTENTS));
            var fileReference = new HttpFileReference(fakeFileSystem, httpClient, SOURCE_URL);

            Assert.ThrowsAsync <SymbolStoreException>(() => fileReference.CopyToAsync(DEST_PATH));
        }
Exemplo n.º 2
0
        public async Task CopyToAsync()
        {
            fakeHttpMessageHandler.ContentMap[new Uri(SOURCE_URL)] = CONTENTS;
            var fileReference = new HttpFileReference(fakeFileSystem, httpClient, SOURCE_URL);

            await fileReference.CopyToAsync(DEST_PATH);

            Assert.AreEqual(CONTENTS, fakeFileSystem.GetFile(DEST_PATH).Contents);
        }
Exemplo n.º 3
0
        public async Task CopyTo_DestinationAlreadyExistsAsync()
        {
            var DEST_CONTENTS = new byte[] { 0x56, 0x78 };

            fakeHttpMessageHandler.ContentMap[new Uri(SOURCE_URL)] = CONTENTS;
            fakeFileSystem.AddFile(DEST_PATH, new MockFileData(DEST_CONTENTS));
            var fileReference = new HttpFileReference(fakeFileSystem, httpClient, SOURCE_URL);

            await fileReference.CopyToAsync(DEST_PATH);

            Assert.AreEqual(CONTENTS, fakeFileSystem.GetFile(DEST_PATH).Contents);
        }
Exemplo n.º 4
0
        public void CopyTo_NullDestFilepath()
        {
            var fileReference = new HttpFileReference(fakeFileSystem, httpClient, SOURCE_URL);

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