[Test] public void ModelTestFeedETagRefresh() { RequestSettings settings = new RequestSettings(this.ApplicationName, this.userName, this.passWord); // settings.PageSize = 15; DocumentsRequest r = new DocumentsRequest(settings); // this returns the server default answer Feed <Document> feed = r.GetDocuments(); foreach (Document d in feed.Entries) { Assert.IsTrue(d != null, "We should have something"); } Feed <Document> reload = r.Get(feed, FeedRequestType.Refresh); // now this should result in a notmodified try { foreach (Document d in reload.Entries) { Assert.IsTrue(d == null, "We should not get here"); } } catch (GDataNotModifiedException g) { Assert.IsTrue(g != null); } }
public void OAuth2LeggedDocumentsTest() { Tracing.TraceMsg("Entering OAuth2LeggedDocumentsTest"); RequestSettings rs = new RequestSettings(this.ApplicationName, this.oAuthConsumerKey, this.oAuthConsumerSecret, this.oAuthUser, this.oAuthDomain); DocumentsRequest dr = new DocumentsRequest(rs); Feed <Document> f = dr.GetDocuments(); // modify one foreach (Document d in f.Entries) { string s = d.AtomEntry.EditUri.ToString(); d.AtomEntry.EditUri = new AtomUri(s.Replace("@", "%40")); dr.Update(d); AclQuery q = new AclQuery(); q.Uri = d.AccessControlList; Feed <Google.AccessControl.Acl> facl = dr.Get <Google.AccessControl.Acl>(q); foreach (Google.AccessControl.Acl a in facl.Entries) { s = a.AclEntry.EditUri.ToString(); a.AclEntry.EditUri = new AtomUri(s.Replace("@", "%40")); dr.Update(a); } } }
private static void DeleteTestNote(DocumentsRequest service) { //ToDo: Doesn'T work always, frequently throwing 401, Precondition failed, maybe Google API bug //service.Delete(createdEntry); //Todo: Workaround to load document again DocumentQuery query = new DocumentQuery(service.BaseUri); query.NumberToRetrieve = 500; Feed <Document> feed = service.Get <Document>(query); Logger.Log("Loaded Google notes", EventType.Information); foreach (Document entry in feed.Entries) { if (entry.Title == "AN_OUTLOOK_TEST_NOTE") { //service.Delete(entry); service.Delete(new Uri(Google.GData.Documents.DocumentsListQuery.documentsBaseUri + "/" + entry.ResourceId), entry.ETag); Logger.Log("Deleted Google note", EventType.Information); //break; } } }
public void ModelTestACLs() { RequestSettings settings = new RequestSettings(this.ApplicationName, this.userName, this.passWord); // settings.PageSize = 15; DocumentsRequest r = new DocumentsRequest(settings); // this returns the server default answer Feed <Document> feed = r.GetDocuments(); foreach (Document x in feed.Entries) { Assert.IsTrue(x != null, "We should have something"); Assert.IsNotNull(x.AccessControlList); Feed <Acl> f = r.Get <Acl>(x.AccessControlList); foreach (Acl a in f.Entries) { Assert.IsNotNull(a.Role); Assert.IsNotNull(a.Scope); Assert.IsNotNull(a.Scope.Type); Assert.IsNotNull(a.Scope.Value); } } }
[Test] public void ModelTestFeedETagRefresh() { RequestSettings settings = new RequestSettings(this.ApplicationName, this.userName, this.passWord); // settings.PageSize = 15; DocumentsRequest r = new DocumentsRequest(settings); // this returns the server default answer Feed<Document> feed = r.GetDocuments(); foreach (Document d in feed.Entries ) { Assert.IsTrue(d != null, "We should have something"); } Feed<Document> reload = r.Get(feed, FeedRequestType.Refresh); // now this should result in a notmodified try { foreach (Document d in reload.Entries ) { Assert.IsTrue(d == null, "We should not get here"); } } catch (GDataNotModifiedException g) { Assert.IsTrue(g!=null); } }
public void OAuth2LeggedDocumentsTest() { Tracing.TraceMsg("Entering OAuth2LeggedDocumentsTest"); RequestSettings rs = new RequestSettings(this.ApplicationName, this.oAuthConsumerKey, this.oAuthConsumerSecret, this.oAuthUser, this.oAuthDomain); DocumentsRequest dr = new DocumentsRequest(rs); Feed<Document> f = dr.GetDocuments(); // modify one foreach (Document d in f.Entries) { string s = d.AtomEntry.EditUri.ToString(); d.AtomEntry.EditUri = new AtomUri(s.Replace("@", "%40")); dr.Update(d); AclQuery q = new AclQuery(); q.Uri = d.AccessControlList; Feed<Google.AccessControl.Acl> facl = dr.Get<Google.AccessControl.Acl>(q); foreach (Google.AccessControl.Acl a in facl.Entries) { s = a.AclEntry.EditUri.ToString(); a.AclEntry.EditUri = new AtomUri(s.Replace("@", "%40")); dr.Update(a); } } }
public void ModelTestACLs() { RequestSettings settings = new RequestSettings(this.ApplicationName, this.userName, this.passWord); // settings.PageSize = 15; DocumentsRequest r = new DocumentsRequest(settings); // this returns the server default answer Feed<Document> feed = r.GetDocuments(); foreach (Document x in feed.Entries) { Assert.IsTrue(x != null, "We should have something"); Assert.IsNotNull(x.AccessControlList); Feed<Acl> f = r.Get<Acl>(x.AccessControlList); foreach (Acl a in f.Entries) { Assert.IsNotNull(a.Role); Assert.IsNotNull(a.Scope); Assert.IsNotNull(a.Scope.Type); Assert.IsNotNull(a.Scope.Value); } } }
private static void DeleteTestNote(DocumentsRequest service) { //ToDo: Doesn'T work always, frequently throwing 401, Precondition failed, maybe Google API bug //service.Delete(createdEntry); //Todo: Workaround to load document again DocumentQuery query = new DocumentQuery(service.BaseUri); query.NumberToRetrieve = 500; Feed<Document> feed = service.Get<Document>(query); Logger.Log("Loaded Google notes", EventType.Information); foreach (Document entry in feed.Entries) { if (entry.Title == "AN_OUTLOOK_TEST_NOTE") { //service.Delete(entry); service.Delete(new Uri(Google.GData.Documents.DocumentsListQuery.documentsBaseUri + "/" + entry.ResourceId), entry.ETag); Logger.Log("Deleted Google note", EventType.Information); //break; } } }