public async Task Setup() { SharedSetup(); _expected = new MemoryStream(new byte[] { 1, 2, 3, 4, 5, 6, 7 }); ShareClient.Setup(s => s.GetRootDirectoryClient()) .Returns((_directory = new Mock <ShareDirectoryClient>()).Object); _directory.Setup(s => s.GetFileClient(It.IsAny <string>())) .Returns((_fileClient = new Mock <ShareFileClient>()).Object); _fileClient.Setup(s => s.DownloadAsync( It.IsAny <HttpRange>(), It.IsAny <bool>(), It.IsAny <ShareFileRequestConditions>(), It.IsAny <CancellationToken>())) .ReturnsAsync((_response = new Mock <Response <ShareFileDownloadInfo> >()).Object); _response.Setup(s => s.Value) .Returns(FilesModelFactory.StorageFileDownloadInfo(content: _expected, contentLength: _expected.Length)); _fileClient.Setup(s => s.ExistsAsync(It.IsAny <CancellationToken>())) .ReturnsAsync((_existsResponse = new Mock <Response <bool> >()).Object); _existsResponse.Setup(s => s.Value) .Returns(true); _output = await ClassInTest.DownloadAsync(_input = "some-path", CancellationToken.None); }
public void Exception_Thrown(string path) { Assert.That(() => ClassInTest.DownloadAsync(path, CancellationToken.None), ThrowsArgumentException("path", "Value must not be null or whitespace")); }