public async void Calendars_AddOrUpdateEvents_AddsEvents() { var events = new List <CalendarEvent> { new CalendarEvent { Name = "Bob", Description = "Bob's event", Start = DateTime.Today.AddDays(5), End = DateTime.Today.AddDays(5).AddHours(2), AllDay = false }, new CalendarEvent { Name = "Steve", Description = "Steve's event", Start = DateTime.Today.AddDays(7), End = DateTime.Today.AddDays(8), AllDay = true }, new CalendarEvent { Name = "Wheeee", Description = "Fun times", Start = DateTime.Today.AddDays(13), End = DateTime.Today.AddDays(15), AllDay = true } }; var calendar = new Calendar { Name = _calendarName }; await _service.AddOrUpdateCalendarAsync(calendar); foreach (var cev in events) { await _service.AddOrUpdateEventAsync(calendar, cev); } var eventResults = await _service.GetEventsAsync(calendar, DateTime.Today, DateTime.Today.AddDays(30)); Assert.That(eventResults, Is.EqualTo(events).Using <CalendarEvent>(_eventComparer)); // Extra check that DateTime.Kinds are local Assert.AreEqual(DateTimeKind.Local, eventResults.Select(e => e.Start.Kind).Distinct().Single()); Assert.AreEqual(DateTimeKind.Local, eventResults.Select(e => e.End.Kind).Distinct().Single()); }
public async Task Calendars_AddOrUpdateEvents_AddsEvents() { var events = GetTestEvents(); var calendar = new Calendar { Name = _calendarName }; await _service.AddOrUpdateCalendarAsync(calendar); foreach (var cev in events) { await _service.AddOrUpdateEventAsync(calendar, cev); } var eventResults = await _service.GetEventsAsync(calendar, DateTime.Today, DateTime.Today.AddDays(30)); Assert.IsNotNull(eventResults); CollectionAssert.AreEqual((ICollection)events, (ICollection)eventResults, _eventComparer); // Extra check that DateTime.Kinds are local Assert.AreEqual(DateTimeKind.Local, eventResults.Select(e => e.Start.Kind).Distinct().Single()); Assert.AreEqual(DateTimeKind.Local, eventResults.Select(e => e.End.Kind).Distinct().Single()); }