// [Ignore] // - this test requires user interaction public async Task DeleteCalendar() { var auth = new GoogleOAuth2("email profile https://www.googleapis.com/auth/calendar"); _token = await auth.Authenticate(_token); Assert.IsNotNull(_token, "auth failed"); var client = new RestClient("https://www.googleapis.com/calendar/v3"); client.Authenticator = new OAuth2AuthorizationRequestHeaderAuthenticator(_token); dynamic proxy = new RestSharpProxy(client); var list = await proxy.users.me.calendarList.get(); Assert.IsNotNull(list); string id = ((IEnumerable <dynamic>)(list.items)).Where(cal => cal.summary == "unit_testing").Select(cal => (string)cal.id).FirstOrDefault(); Assert.IsFalse(string.IsNullOrEmpty(id)); var result = await proxy.calendars(id).delete(); Assert.IsNull(result); //list = await proxy.users.me.calendarList.get(); //Assert.IsNotNull(list); //id = ((IEnumerable<dynamic>)(list.items)).Where(cal => cal.summary == "unit_testing").Select(cal => (string)cal.id).FirstOrDefault(); //Assert.IsTrue(string.IsNullOrEmpty(id)); }
// [Ignore] // - this test requires user interaction public async Task UpdateCalendar() { var auth = new GoogleOAuth2("email profile https://www.googleapis.com/auth/calendar"); _token = await auth.Authenticate(_token); Assert.IsNotNull(_token, "auth failed"); var client = new RestClient("https://www.googleapis.com/calendar/v3"); client.Authenticator = new OAuth2AuthorizationRequestHeaderAuthenticator(_token); dynamic proxy = new RestSharpProxy(client); var list = await proxy.users.me.calendarList.get(); Assert.IsNotNull(list); string id = ((IEnumerable <dynamic>)(list.items)).Where(cal => cal.summary == "unit_testing").Select(cal => (string)cal.id).FirstOrDefault(); Assert.IsFalse(string.IsNullOrEmpty(id)); var guid = Guid.NewGuid().ToString(); dynamic calendar = new ExpandoObject(); calendar.summary = "unit_testing"; calendar.description = guid; var result = await proxy.calendars(id).put(calendar); Assert.IsNotNull(result); list = await proxy.users.me.calendarList.get(); Assert.IsNotNull(list); string description = ((IEnumerable <dynamic>)(list.items)).Where(cal => cal.summary == "unit_testing").Select(cal => (string)cal.description).FirstOrDefault(); Assert.AreEqual(guid, description); }