示例#1
0
        public async Task AttachmentDelete()
        {
            var mock = new Mock<ITimelineService>();
            mock.Setup(m => m.FileExists(It.IsAny<string>())).Returns(true);
            mock.SetupGet(m => m.CacheFolder).Returns("cache");

            Attachment attachment = new Attachment();
            attachment.Id = "ID1";

            await attachment.DeleteAsync(mock.Object);

            mock.Verify(m => m.PutJsonAsync("TimelineEventAttachment/Delete", It.Is<object>(o => o.VerifyObject("AttachmentId", "ID1"))));
            mock.Verify(m => m.FileDelete($@"cache\{attachment.Name}"));
        }