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; } } }
/// <summary> /// tests etag refresh on an entry level /// </summary> [Test] public void ModelTestFolders() { const string testTitle = "That is a new & weird subfolder"; const string parentTitle = "Granddaddy folder"; string parentID; string folderID; RequestSettings settings = new RequestSettings(this.ApplicationName, this.userName, this.passWord); // settings.PageSize = 15; DocumentsRequest r = new DocumentsRequest(settings); Document folder = new Document(); folder.Type = Document.DocumentType.Folder; folder.Title = testTitle; /// first create the folder folder = r.CreateDocument(folder); Assert.IsTrue(folder.Title == testTitle); r.Delete(folder); // let's create a hierarchy Document parent = new Document(); parent.Type = Document.DocumentType.Folder; parent.Title = parentTitle; parent = r.CreateDocument(parent); parentID = parent.Id; // create the child folder = new Document(); folder.Type = Document.DocumentType.Folder; folder.Title = testTitle; /// first create the folder folder = r.CreateDocument(folder); folderID = folder.Id; // now move the folder into the parent r.MoveDocumentTo(parent, folder); // now get the folder list Feed<Document> folders = r.GetFolders(); int iVerify = 2; List<Document> list = new List<Document>(); foreach (Document f in folders.Entries ) { list.Add(f); } bool found = false; foreach (Document f in list ) { Assert.IsTrue(f.Type == Document.DocumentType.Folder, "this should be a folder"); if (f.Id == parentID) { iVerify--; } if (f.Id == folderID) { iVerify--; // let's find the guy again. foreach (Document d in list) { if (f.ParentFolders.Contains(d.Self)) { found = true; break; } } } } Assert.IsTrue(found, "we did not find the parent folder"); Assert.IsTrue(iVerify==0, "We should have found both folders"); }
/// <summary> /// tests etag refresh on an entry level /// </summary> [Test] public void ModelTestFolders() { const string testTitle = "That is a new & weird subfolder"; const string parentTitle = "Granddaddy folder"; string parentID; string folderID; RequestSettings settings = new RequestSettings(this.ApplicationName, this.userName, this.passWord); // settings.PageSize = 15; DocumentsRequest r = new DocumentsRequest(settings); Document folder = new Document(); folder.Type = Document.DocumentType.Folder; folder.Title = testTitle; /// first create the folder folder = r.CreateDocument(folder); Assert.IsTrue(folder.Title == testTitle); r.Delete(folder); // let's create a hierarchy Document parent = new Document(); parent.Type = Document.DocumentType.Folder; parent.Title = parentTitle; parent = r.CreateDocument(parent); parentID = parent.Id; // create the child folder = new Document(); folder.Type = Document.DocumentType.Folder; folder.Title = testTitle; /// first create the folder folder = r.CreateDocument(folder); folderID = folder.Id; // now move the folder into the parent r.MoveDocumentTo(parent, folder); // now get the folder list Feed <Document> folders = r.GetFolders(); int iVerify = 2; List <Document> list = new List <Document>(); foreach (Document f in folders.Entries) { list.Add(f); } bool found = false; foreach (Document f in list) { Assert.IsTrue(f.Type == Document.DocumentType.Folder, "this should be a folder"); if (f.Id == parentID) { iVerify--; } if (f.Id == folderID) { iVerify--; // let's find the guy again. foreach (Document d in list) { if (f.ParentFolders.Contains(d.Self)) { found = true; break; } } } } Assert.IsTrue(found, "we did not find the parent folder"); Assert.IsTrue(iVerify == 0, "We should have found both folders"); }
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; } } }