示例#1
0
        public async Task GetAllRemindersGeneratesExpectedCall()
        {
            var reminder  = Utility.ExampleFileContent("reminderList.json");
            var netClient = new HttpClient(new ActionMessageHandler(req =>
            {
                Assert.Equal(HttpMethod.Get, req.Method);
                Assert.Equal("/v1/alerts/reminders", req.RequestUri.PathAndQuery);

                return(new HttpResponseMessage(HttpStatusCode.OK)
                {
                    Content = new StringContent(reminder)
                });
            }));

            var client   = new RemindersClient(netClient);
            var response = await client.Get();

            Assert.NotNull(response);
            Assert.Equal(1, response.TotalCount);
            Assert.Single(response.Alerts);
            var item = response.Alerts.First();

            Assert.IsType <ReminderInformation>(item);
            Assert.IsType <RelativeTriggerInformation>(item.Trigger);
            Assert.Equal("79559745-635b-44cb-ba9d-9f364d41600d", item.AlertToken);
        }
示例#2
0
        public static async Task <bool> AnyActiveRemindersAsync(SkillRequest skillRequest)
        {
            var client = new RemindersClient(skillRequest);

            return((await client.Get())?.Alerts?.Any(a => a.Status == ReminderStatus.On) ?? false);
        }