Example #1
0
        public async Task EventCreate()
        {
            var mock = new Mock <ITimelineService>();

            mock.Setup(m => m.PutJsonAsync(It.IsAny <string>(), It.IsAny <object>())).Returns(TestUtils.GetCompletedTask(TimelineEventJson));

            var dateTime = new DateTime(636546626588300000);
            var result   = await TimelineEvent.CreateAsync(mock.Object, "Test Title", "Test Description", dateTime, "-1.1234,1.1234");

            mock.Verify(m => m.PutJsonAsync("TimelineEvent/Create", It.Is <object>(o => o.VerifyIsGuid("TimelineEventId") &&
                                                                                   o.VerifyObject("Title", "Test Title") &&
                                                                                   o.VerifyObject("Description", "Test Description") &&
                                                                                   o.VerifyObject("EventDateTime", "636546626588300000") &&
                                                                                   o.VerifyObject("Location", "-1.1234,1.1234"))));
            Assert.AreEqual(result.Id, "ID1");
            Assert.AreEqual(result.TenantId, "123");
            Assert.AreEqual(result.Title, "Test Title");
            Assert.AreEqual(result.Description, "Test Description");
            Assert.AreEqual(result.EventDateTime, dateTime);
            Assert.AreEqual(result.Location, "-1.1234,1.1234");
        }