Exemplo n.º 1
0
        public async Task AttachmentCreate()
        {
            var mock = new Mock<ITimelineService>();
            mock.Setup(m => m.PutJsonAsync(It.IsAny<string>(), It.IsAny<object>())).Returns(TestUtils.GetCompletedTask(AttachmentJson));

            Attachment attachment = await Attachment.CreateAsync(mock.Object, "ID1", "Test Title");

            mock.Verify(m => m.PutJsonAsync("TimelineEventAttachment/Create", It.Is<object>(o => o.VerifyIsGuid("AttachmentId") && o.VerifyObject("TimelineEventId", "ID1") && o.VerifyObject("Title", "Test Title"))));
            Assert.AreEqual(attachment.Id, "ID1");
            Assert.AreEqual(attachment.TimelineEventId, "ID2");
            Assert.AreEqual(attachment.Title, "Test Title");
            Assert.AreEqual(attachment.TenantId, "Team3");
            Assert.IsTrue(attachment.IsDeleted);
        }