Exemple #1
0
        public async Task DownloadAttachmentAlreadyInCache()
        {
            string presignedUrl = "http://www.test.com/presignedurl";
            var mock = new Mock<ITimelineService>();
            mock.Setup(m => m.GetJsonAsync(It.IsAny<string>(), It.IsAny<NameValueCollection>())).Returns(TestUtils.GetCompletedTask(presignedUrl));
            mock.Setup(m => m.FileExists(It.IsAny<string>())).Returns(true);
            mock.SetupGet(m => m.CacheFolder).Returns("cache");

            Attachment attachment = new Attachment();
            attachment.Id = "ID1";
            attachment.Title = "filename.docx";

            await attachment.DownloadOrCacheAsync(mock.Object);

            mock.Verify(m => m.DownloadFileAsync(presignedUrl, @"cache\ID1.docx"), Times.Never());
        }