Пример #1
0
        private static async Task <MiniEvent> FindEvent(CalendarApi calendar, string calendarClass, string title, DateTime startTime)
        {
            var tzi = TimeZoneInfo.FindSystemTimeZoneById(Util.PstIdString());
            var events = await calendar.GetEvents(calendarClass);

            return(events.FirstOrDefault(e =>
            {
                var eventStartTime = XmlConvert.ToDateTime(e.StartTime, XmlDateTimeSerializationMode.Utc).AddHours(tzi.BaseUtcOffset.Hours);
                return e.Title == title && eventStartTime == startTime;
            }));
        }
Пример #2
0
        public void CreateEvent()
        {
            var startTime = DateTime.Now.AddHours(2);
            var duration  = new TimeSpan(0, 3, 0, 0);
            var @event    = CalendarApi.CreateEvent(CalendarId, "test summary", "test description", startTime, duration).Result;

            @event.ShouldNotBeNull();
            var events    = CalendarApi.GetEvents(CalendarId);
            var theEvents = events.Result;
            var theEvent  = theEvents.Find(id => id.Id == @event.Id);

            theEvent.Id.ShouldEqual(@event.Id);
            theEvent.Description.ShouldEqual(@event.Description);
            theEvent.Summary.ShouldEqual(@event.Summary);
            CalendarApi.DeleteEvent(CalendarId, @event.Id);
        }
Пример #3
0
        public void Get10Events()
        {
            var numberOfEvents = CalendarApi.GetEvents(CalendarId).Result;

            numberOfEvents.Count.ShouldBeGreaterThanOrEqualTo(1);
        }