///////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// /// <summary>[Test] creates a new entry, saves and loads it back</summary> ////////////////////////////////////////////////////////////////////// [Test] public void CreateEmptyEntrySaveAndLoad() { Tracing.TraceMsg("Entering Create/Save/Load test"); AtomEntry entry = ObjectModelHelper.CreateAtomEntry(1); entry.Content.Type = "text"; entry.Content.Content = ""; ObjectModelHelper.DumpAtomObject(entry, CreateDumpFileName("CreateEmptyEntrySaveAndLoad")); // let's try loading this... Service service = new Service(); service.RequestFactory = this.factory; FeedQuery query = new FeedQuery(); query.Uri = new Uri(CreateUriLogFileName("CreateEmptyEntrySaveAndLoad")); AtomFeed feed = service.Query(query); Assert.IsTrue(feed.Entries != null, "Feed.Entries should not be null"); Assert.AreEqual(1, feed.Entries.Count, "Feed.Entries should have ONE element"); // that feed should have ONE entry if (feed.Entries != null) { AtomEntry theOtherEntry = feed.Entries[0]; Assert.IsTrue(ObjectModelHelper.IsEntryIdentical(entry, theOtherEntry), "Entries should be identical"); } }
///////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// /// <summary>[Test] creates a new feed, saves and loads it back</summary> ////////////////////////////////////////////////////////////////////// [Test] public void CreateFeedObjectSaveAndLoad() { Tracing.TraceMsg("Entering CreateFeedObjectSaveAndLoad test"); Service service = new Service(); AtomFeed feed = new AtomFeed(new Uri("http://www.atomfeed.com/"), service); feed.Self = "http://www.atomfeed.com/self"; feed.Feed = "http://www.atomfeed.com/feed"; feed.NextChunk = "http://www.atomfeed.com/next"; feed.PrevChunk = "http://www.atomfeed.com/prev"; feed.Post = "http://www.atomfeed.com/post"; ObjectModelHelper.DumpAtomObject(feed, CreateDumpFileName("CreateFeedSaveAndLoad")); // let's try loading this... service.RequestFactory = this.factory; FeedQuery query = new FeedQuery(); query.Uri = new Uri(CreateUriLogFileName("CreateFeedSaveAndLoad")); feed = service.Query(query); Assert.AreEqual("http://www.atomfeed.com/self", feed.Self, "Feed.Self is not correct"); Assert.AreEqual("http://www.atomfeed.com/feed", feed.Feed, "Feed.Feed is not correct"); Assert.AreEqual("http://www.atomfeed.com/next", feed.NextChunk, "Feed.Next is not correct"); Assert.AreEqual("http://www.atomfeed.com/prev", feed.PrevChunk, "Feed.Prev is not correct"); Assert.AreEqual("http://www.atomfeed.com/post", feed.Post, "Feed.Post is not correct"); }
///////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// /// <summary>compares 2 text construct objects</summary> /// <param name="theOne">the One</param> /// <param name="theOther">the Other</param> /// <returns>true if identical </returns> ////////////////////////////////////////////////////////////////////// public static bool IsTextConstructIdentical(AtomTextConstruct theOne, AtomTextConstruct theOther) { if (theOne == null && theOther == null) { return(true); } if (!ObjectModelHelper.IsBaseIdentical(theOne, theOther)) { return(false); } if (theOne.Type != theOther.Type) { return(false); } if (String.Compare(theOne.Text, theOther.Text) != 0) { return(false); } if (String.Compare(theOne.XmlName, theOther.XmlName) != 0) { return(false); } return(true); }
///////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// /// <summary>compares 2 Generator objects</summary> /// <param name="theOne">the One</param> /// <param name="theOther">the Other</param> /// <returns>true if identical </returns> ////////////////////////////////////////////////////////////////////// public static bool IsGeneratorIdentical(AtomGenerator theOne, AtomGenerator theOther) { if (theOne == null && theOther == null) { return(true); } if (!ObjectModelHelper.IsBaseIdentical(theOne, theOther)) { return(false); } if (String.Compare(theOne.Text, theOther.Text) != 0) { return(false); } if (String.Compare(theOne.Version, theOther.Version) != 0) { return(false); } if (AtomUri.Compare(theOne.Uri, theOther.Uri) != 0) { return(false); } return(true); }
///////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// /// <summary>creates a number or rows </summary> ////////////////////////////////////////////////////////////////////// [Test] public void DefaultHostInsertAndStay() { Tracing.TraceMsg("Entering DefaultHostInsertAndStay"); int iCount = 0; FeedQuery query = new FeedQuery(); Service service = new Service(); service.RequestFactory = this.factory; query.Uri = new Uri(this.defaultHost); AtomFeed returnFeed = service.Query(query); AtomEntry entry; iCount = returnFeed.Entries.Count; // now we have all we need. for (int i = 0; i < this.iIterations; i++) { Tracing.TraceMsg("DefaultHostInsertAndStay: inserting entry #: " + i); entry = ObjectModelHelper.CreateAtomEntry(i); entry = returnFeed.Insert(entry); } Tracing.TraceMsg("DefaultHostInsertAndStay: inserted lot's of entries"); // done doing the inserts... // now query the guy again. returnFeed = service.Query(query); Assert.AreEqual(iCount + this.iIterations, returnFeed.Entries.Count, "feed should have " + this.iIterations + " more entries now"); }
///////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// /// <summary>compares 2 content objects</summary> /// <param name="theOne">the One content </param> /// <param name="theOther">the Other content</param> /// <returns>true if identical </returns> ////////////////////////////////////////////////////////////////////// public static bool IsContentIdentical(AtomContent theOne, AtomContent theOther) { if (theOne == null && theOther == null) { return(true); } if (!ObjectModelHelper.IsBaseIdentical(theOne, theOther)) { return(false); } if (String.Compare(theOne.Type, theOther.Type) != 0) { return(false); } if (AtomUri.Compare(theOther.Src, theOther.Src) != 0) { return(false); } String content = theOther.Content == null ? "" : theOther.Content; String other = theOne.Content == null ? "" : theOne.Content; if (String.Compare(content, other) != 0) { return(false); } return(true); }
///////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// /// <summary>compares a category</summary> /// <param name="theOne">the One category </param> /// <param name="theOther">the Other category</param> /// <returns>true if identical </returns> ////////////////////////////////////////////////////////////////////// public static bool IsCategoryIdentical(AtomCategory theOne, AtomCategory theOther) { if (theOne == null && theOther == null) { return(true); } if (!ObjectModelHelper.IsBaseIdentical(theOne, theOther)) { return(false); } if (String.Compare(theOne.Label, theOther.Label) != 0) { return(false); } if (String.Compare(theOne.Term, theOther.Term) != 0) { return(false); } if (AtomUri.Compare(theOne.Scheme, theOther.Scheme) != 0) { return(false); } return(true); }
///////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// /// <summary>public static bool IsPersonIdentical(AtomPerson theOne, AtomPerson theOther)</summary> /// <param name="theOne">the One Person </param> /// <param name="theOther">the Other Person</param> /// <returns>true if identical </returns> ////////////////////////////////////////////////////////////////////// public static bool IsPersonIdentical(AtomPerson theOne, AtomPerson theOther) { if (theOne == null && theOther == null) { return(true); } if (!ObjectModelHelper.IsBaseIdentical(theOne, theOther)) { Tracing.TraceInfo("IsPersonIdentical: comparing base failed"); return(false); } Tracing.TraceInfo("IsPersonIdentical: comparing Name " + theOne.Name + " " + theOther.Name); if (String.Compare(theOne.Email, theOther.Email) != 0) { Tracing.TraceInfo("IsPersonIdentical: comparing email failed" + theOne.Email + " " + theOther.Email); return(false); } if (String.Compare(theOne.Name, theOther.Name) != 0) { Tracing.TraceInfo("IsPersonIdentical: comparing Name failed" + theOne.Name + " " + theOther.Name); return(false); } if (AtomUri.Compare(theOne.Uri, theOther.Uri) != 0) { Tracing.TraceInfo("IsPersonIdentical: comparing URI failed - " + theOne.Uri.ToString() + " " + theOther.Uri.ToString()); return(false); } return(true); }
///////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// /// <summary>[Test] creates a new entry, saves and loads it back /// uses HTML content to test the persistence/encoding code /// </summary> ////////////////////////////////////////////////////////////////////// [Test] public void CreateHTMLEntrySaveAndLoad() { Tracing.TraceMsg("Entering CreateHTMLEntrySaveAndLoad"); AtomEntry entry = ObjectModelHelper.CreateAtomEntry(1); entry.Content.Type = "html"; entry.Content.Content = HttpUtility.HtmlDecode("<b>this is a <test></b>"); Tracing.TraceMsg("Content: " + entry.Content.Content); ObjectModelHelper.DumpAtomObject(entry, CreateDumpFileName("CreateHTMLEntrySaveAndLoad")); // let's try loading this... Service service = new Service(); service.RequestFactory = this.factory; FeedQuery query = new FeedQuery(); query.Uri = new Uri(CreateUriLogFileName("CreateHTMLEntrySaveAndLoad")); AtomFeed feed = service.Query(query); Assert.IsTrue(feed.Entries != null, "Feed.Entries should not be null"); Assert.AreEqual(1, feed.Entries.Count, "Feed.Entries should have ONE element"); // that feed should have ONE entry if (feed.Entries != null) { AtomEntry theOtherEntry = feed.Entries[0]; Tracing.TraceMsg("Loaded Content: " + theOtherEntry.Content.Content); Assert.IsTrue(ObjectModelHelper.IsEntryIdentical(entry, theOtherEntry)); } }
///////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// /// <summary>[Test] creates a new entry, saves and loads it back</summary> ////////////////////////////////////////////////////////////////////// [Test] public void DefaultHostInsertOneAndDelete() { Tracing.TraceMsg("Entering DefaultHostInsertOneAndDelete"); AtomEntry entry = ObjectModelHelper.CreateAtomEntry(1); Service service = new Service(); FeedQuery query = new FeedQuery(); service.RequestFactory = this.factory; int iCount = 0; string strTitle = "DefaultHostInsertOneAndDelete" + Guid.NewGuid().ToString(); entry.Title.Text = strTitle; query.Uri = new Uri(this.defaultHost); AtomFeed returnFeed = service.Query(query); iCount = returnFeed.Entries.Count; for (int i = 0; i < this.iIterations; i++) { Tracing.TraceMsg("DefaultHostInsertOneAndDelete, iteration : " + i); Stream s = service.EntrySend(new Uri(this.defaultHost), entry, GDataRequestType.Insert); s.Close(); returnFeed = service.Query(query); Assert.AreEqual(iCount + 1, returnFeed.Entries.Count, "feed should have one more entry now"); AtomEntry returnEntry = null; foreach (AtomEntry feedEntry in returnFeed.Entries) { if (String.Compare(feedEntry.Title.Text, strTitle) == 0) { // got him returnEntry = feedEntry; break; } } Assert.IsTrue(returnEntry != null, "did not find the just inserted entry"); returnEntry.Delete(); // query again and check count returnFeed = service.Query(query); Assert.AreEqual(iCount, returnFeed.Entries.Count, "feed has different number of entries as expected"); } }
///////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// /// <summary>[Test] creates a new entry, saves and loads it back /// uses XHTML content to test the persistence/encoding code /// </summary> ////////////////////////////////////////////////////////////////////// [Test] public void CreateXHTMLEntrySaveAndLoad() { Tracing.TraceMsg("Entering CreateXHTMLEntrySaveAndLoad"); AtomEntry entry = ObjectModelHelper.CreateAtomEntry(1); entry.Content.Type = "xhtml"; entry.Content.Content = HttpUtility.HtmlDecode("<div xmlns=\"http://www.w3.org/2005/Atom\"><b>this is a test</b></div>"); Tracing.TraceMsg("Content: " + entry.Content.Content); ObjectModelHelper.DumpAtomObject(entry, CreateDumpFileName("CreateXHTMLEntrySaveAndLoad")); Tracing.TraceMsg("saved in... CreateXHTMLEntrySaveAndLoad"); // let's try loading this... Service service = new Service(); service.RequestFactory = this.factory; FeedQuery query = new FeedQuery(); query.Uri = new Uri(CreateUriLogFileName("CreateXHTMLEntrySaveAndLoad")); AtomFeed feed = service.Query(query); Tracing.TraceMsg("loaded in... CreateXHTMLEntrySaveAndLoad"); Assert.IsTrue(feed.Entries != null, "Feed.Entries should not be null"); Assert.AreEqual(1, feed.Entries.Count, "Feed.Entries should have ONE element"); // that feed should have ONE entry if (feed.Entries != null) { Tracing.TraceMsg("checking entries... CreateXHTMLEntrySaveAndLoad"); AtomEntry theOtherEntry = feed.Entries[0]; Assert.IsTrue(theOtherEntry.Content != null, "the entry should have a content element"); Assert.IsTrue(theOtherEntry.Content.Type.Equals("xhtml"), "the entry should have a content element of type xhtml"); Assert.IsTrue(theOtherEntry.Content.Content != null, "the entry should have a content element that is not empty"); Tracing.TraceMsg("Loaded Content: " + theOtherEntry.Content.Content); Assert.IsTrue(ObjectModelHelper.IsEntryIdentical(entry, theOtherEntry)); Tracing.TraceMsg("done comparing entries... CreateXHTMLEntrySaveAndLoad"); } }
///////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// /// <summary>[Test] queries the remote feed, saves it, loads it and compares it</summary> /// <param name="uriToQuery">the host to access, including query parameters</param> ////////////////////////////////////////////////////////////////////// internal void RemoteHostQueryAndCompare(Uri uriToQuery) { Tracing.TraceMsg("Entering RemoteHostQueryAndCompare"); int iCount = 0; FeedQuery query = new FeedQuery(); query.Uri = uriToQuery; Service service = new Service(); service.RequestFactory = this.factory; AtomFeed f = service.Query(query); ObjectModelHelper.DumpAtomObject(f, CreateDumpFileName("QueryRemoteHost")); iCount = f.Entries.Count; // let's try loading this... Service service2 = new Service(); FeedQuery query2 = new FeedQuery(); query2.Uri = new Uri(CreateUriLogFileName("QueryRemoteHost")); AtomFeed feed = service2.Query(query2); Assert.AreEqual(iCount, feed.Entries.Count, "loaded feed has different number of entries"); Tracing.TraceInfo("Comparing feed objects as source"); Assert.IsTrue(ObjectModelHelper.IsSourceIdentical(f, feed), "Feeds are not identical"); if (feed.Entries != null) { AtomEntry theOtherEntry; Tracing.TraceInfo("Comparing Entries"); for (int i = 0; i < feed.Entries.Count; i++) { theOtherEntry = feed.Entries[i]; Assert.IsTrue(ObjectModelHelper.IsEntryIdentical(f.Entries[i], theOtherEntry), "Entries are not identical"); } } Tracing.TraceInfo("Leaving RemoteHostQueryAndCompare for : " + uriToQuery.AbsoluteUri); }
///////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// /// <summary>creates X rows and updates it</summary> ////////////////////////////////////////////////////////////////////// [Test] public void DefaultHostMassiveInsertAndUpdate() { Tracing.TraceMsg("Entering DefaultHostMassiveInsertAndUpdate"); int iCount = 0; FeedQuery query = new FeedQuery(); Service service = new Service(); service.RequestFactory = this.factory; query.Uri = new Uri(this.defaultHost); AtomFeed returnFeed = service.Query(query); AtomEntry entry; iCount = returnFeed.Entries.Count; // now we have all we need. int z = 0; for (int i = 0; i < this.iIterations; i++) { z++; if (z > 500) { z = 0; // do a requery every hundreth to see mem usage Tracing.TraceMsg("Query at point: " + i); returnFeed = service.Query(query); } Tracing.TraceMsg("Inserting entry: " + i); entry = ObjectModelHelper.CreateAtomEntry(i); entry = returnFeed.Insert(entry); entry.Content.Content = "Updated entry: " + Guid.NewGuid().ToString(); entry.Update(); } // now query the guy again. returnFeed = service.Query(query); Assert.AreEqual(iCount + this.iIterations, returnFeed.Entries.Count, "feed should have " + this.iIterations + " more entries now"); Tracing.TraceMsg("Exiting DefaultHostMassiveInsertAndUpdate"); }
///////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// /// <summary>compares 2 IDs</summary> /// <param name="theOne">the One </param> /// <param name="theOther">the Other</param> /// <returns>true if identical </returns> ////////////////////////////////////////////////////////////////////// public static bool IsBaseLinkIdentical(AtomBaseLink theOne, AtomBaseLink theOther) { if (theOne == null && theOther == null) { return(true); } if (!ObjectModelHelper.IsBaseIdentical(theOne, theOther)) { return(false); } if (AtomUri.Compare(theOne.Uri, theOther.Uri) != 0) { return(false); } return(true); }
///////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// /// <summary>compares 2 link objects</summary> /// <param name="theOne">the One link</param> /// <param name="theOther">the Other link</param> /// <returns>true if identical </returns> ////////////////////////////////////////////////////////////////////// public static bool IsLinkIdentical(AtomLink theOne, AtomLink theOther) { if (theOne == null && theOther == null) { return(true); } if (!ObjectModelHelper.IsBaseIdentical(theOne, theOther)) { return(false); } if (AtomUri.Compare(theOne.HRef, theOther.HRef) != 0) { return(false); } if (theOne.Length != theOther.Length) { return(false); } if (String.Compare(theOne.Rel, theOther.Rel) != 0) { return(false); } if (String.Compare(theOne.Type, theOther.Type) != 0) { return(false); } if (String.Compare(theOne.HRefLang, theOther.HRefLang) != 0) { return(false); } if (String.Compare(theOne.Title, theOther.Title) != 0) { return(false); } return(true); }
///////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// /// <summary>[Test] creates a feed object from scratch</summary> ////////////////////////////////////////////////////////////////////// [Test] public void CreateFeed() { Tracing.TraceInfo("Entering Create Feed Test"); AtomFeed feed = new AtomFeed(new Uri("http://dummy"), null); AtomEntry entry; for (int i = 1; i <= this.iIterations; i++) { entry = ObjectModelHelper.CreateAtomEntry(i); feed.Entries.Add(entry); } Tracing.TraceInfo("now persisting feed"); ObjectModelHelper.DumpAtomObject(feed, CreateDumpFileName("CreateFeed")); Tracing.TraceInfo("now loadiing feed from disk"); Service service = new Service(); service.RequestFactory = this.factory; FeedQuery query = new FeedQuery(); query.Uri = new Uri(CreateUriLogFileName("CreateFeed")); feed = service.Query(query); Assert.IsTrue(feed.Entries != null, "Feed.Entries should not be null"); Assert.AreEqual(this.iIterations, feed.Entries.Count, "Feed.Entries should have 50 elements"); if (feed.Entries != null) { for (int i = 1; i <= this.iIterations; i++) { entry = ObjectModelHelper.CreateAtomEntry(i); AtomEntry theOtherEntry = feed.Entries[i - 1]; Assert.IsTrue(ObjectModelHelper.IsEntryIdentical(entry, theOtherEntry)); } } }
///////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// /// <summary>creates a number or rows and delets them again</summary> ////////////////////////////////////////////////////////////////////// [Test] public void DefaultHostExtensionTest() { Tracing.TraceMsg("Entering DefaultHostExtensionTest"); if (this.strRemoteHost != null) { FeedQuery query = new FeedQuery(); Service service = new Service(); service.NewAtomEntry += new FeedParserEventHandler(this.OnParsedNewEntry); service.NewExtensionElement += new ExtensionElementEventHandler(this.OnNewExtensionElement); service.RequestFactory = (IGDataRequestFactory) new GDataLoggingRequestFactory(this.ServiceName, this.ApplicationName); query.Uri = new Uri(this.strRemoteHost); AtomFeed returnFeed = service.Query(query); ObjectModelHelper.DumpAtomObject(returnFeed, CreateDumpFileName("ExtensionFeed")); } }
///////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// /// <summary>compares two atomEntrys to see if they are identical objects</summary> /// <param name="theOne">the first AtomEntry </param> /// <param name="theOther">the other AtomEntry to compare with </param> /// <returns>true if equal </returns> ////////////////////////////////////////////////////////////////////// public static bool IsEntryIdentical(AtomEntry theOne, AtomEntry theOther) { Tracing.TraceMsg("Entering IsEntryIdentical"); if (theOne == null || theOther == null) { return(theOne == theOther); } Tracing.TraceMsg("Comparing AuthorCollection"); if (!ObjectModelHelper.IsPersonCollectionIdentical(theOne.Authors, theOther.Authors)) { return(false); } Tracing.TraceMsg("Comparing ContributorCollection"); if (!ObjectModelHelper.IsPersonCollectionIdentical(theOne.Contributors, theOther.Contributors)) { return(false); } Tracing.TraceMsg("Comparing CategoryCollection"); if (!ObjectModelHelper.IsCategoryCollectionIdentical(theOne.Categories, theOther.Categories)) { return(false); } Tracing.TraceMsg("Comparing LinkCollection"); if (!ObjectModelHelper.IsLinkCollectionIdentical(theOne.Links, theOther.Links)) { return(false); } Tracing.TraceMsg("Comparing Content"); if (!ObjectModelHelper.IsContentIdentical(theOne.Content, theOther.Content)) { return(false); } Tracing.TraceMsg("Comparing Source"); if (!ObjectModelHelper.IsSourceIdentical(theOne.Source, theOther.Source)) { return(false); } Tracing.TraceMsg("Comparing Summary"); if (!ObjectModelHelper.IsTextConstructIdentical(theOne.Summary, theOther.Summary)) { return(false); } Tracing.TraceMsg("Comparing Title"); if (!ObjectModelHelper.IsTextConstructIdentical(theOne.Title, theOther.Title)) { return(false); } Tracing.TraceMsg("Comparing Rights"); if (!ObjectModelHelper.IsTextConstructIdentical(theOne.Rights, theOther.Rights)) { return(false); } Tracing.TraceMsg("Comparing BaseLink"); if (!ObjectModelHelper.IsBaseLinkIdentical(theOne.Id, theOther.Id)) { return(false); } /* * if (System.DateTime.Compare(theOne.Published, theOther.Published) != 0) * { * return false; * } * if (System.DateTime.Compare(theOne.Updated,theOther.Updated) != 0) * { * return false; * } */ Tracing.TraceMsg("Exiting IsEntryIdentical"); return(true); }
///////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// /// <summary>creates a number or rows and delets them again</summary> ////////////////////////////////////////////////////////////////////// [Test] public void DefaultHostMassiveInsertAndDelete() { Tracing.TraceMsg("Entering DefaultHostMassiveInsertAndDelete"); int iCount = 0; FeedQuery query = new FeedQuery(); Service service = new Service(); service.RequestFactory = this.factory; query.Uri = new Uri(this.defaultHost); AtomFeed returnFeed = service.Query(query); AtomEntry entry; iCount = returnFeed.Entries.Count; AtomEntryCollection newEntries = new AtomEntryCollection(null); // now we have all we need. for (int i = 0; i < this.iIterations; i++) { entry = ObjectModelHelper.CreateAtomEntry(i); entry = returnFeed.Insert(entry); newEntries.Add(entry); } Tracing.TraceMsg("DefaultHostMassiveInsert: inserted lot's of entries"); // done doing the inserts... // now query the guy again. returnFeed = service.Query(query); Assert.AreEqual(iCount + this.iIterations, returnFeed.Entries.Count, "feed should have " + this.iIterations + " more entries now"); // now udpate the 100 entries we have added for (int i = 0; i < this.iIterations; i++) { entry = newEntries[i]; entry.Title.Text = Guid.NewGuid().ToString(); entry.Update(); } Tracing.TraceMsg("DefaultHostMassiveInsert: updated lot's of entries"); returnFeed = service.Query(query); Assert.AreEqual(iCount + this.iIterations, returnFeed.Entries.Count, "feed should have " + this.iIterations + " more entries now"); // let's find them and delete them... for (int i = 0; i < this.iIterations; i++) { entry = newEntries[i]; foreach (AtomEntry feedEntry in returnFeed.Entries) { if (String.Compare(feedEntry.Title.Text, entry.Title.Text) == 0) { // got him Tracing.TraceMsg("trying to delete entry: " + feedEntry.Title.Text + " = " + entry.Title.Text); feedEntry.Delete(); break; } } } // and a last time returnFeed = service.Query(query); Assert.AreEqual(iCount, returnFeed.Entries.Count, "feed should have the same number again"); Tracing.TraceMsg("DefaultHostMassiveInsertAndDelete: deleted lot's of entries"); }
///////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// /// <summary>compares 2 source objects</summary> /// <param name="theOne">the One source</param> /// <param name="theOther">the Other source</param> /// <returns>true if identical </returns> ////////////////////////////////////////////////////////////////////// public static bool IsSourceIdentical(AtomSource theOne, AtomSource theOther) { Tracing.TraceInfo("Comparing source objects"); if (theOne == null && theOther == null) { return(true); } if (!ObjectModelHelper.IsBaseIdentical(theOne, theOther)) { return(false); } Tracing.TraceInfo("Source: comparing Authors collections"); if (!ObjectModelHelper.IsPersonCollectionIdentical(theOne.Authors, theOther.Authors)) { return(false); } Tracing.TraceInfo("Source: comparing Contributors collections"); if (!ObjectModelHelper.IsPersonCollectionIdentical(theOne.Contributors, theOther.Contributors)) { return(false); } Tracing.TraceInfo("Source: comparing categories collections"); if (!ObjectModelHelper.IsCategoryCollectionIdentical(theOne.Categories, theOther.Categories)) { return(false); } Tracing.TraceInfo("Source: comparing links collections"); if (!ObjectModelHelper.IsLinkCollectionIdentical(theOne.Links, theOther.Links)) { return(false); } if (!ObjectModelHelper.IsTextConstructIdentical(theOne.Title, theOther.Title)) { return(false); } if (!ObjectModelHelper.IsTextConstructIdentical(theOne.Rights, theOther.Rights)) { return(false); } if (!ObjectModelHelper.IsTextConstructIdentical(theOne.Subtitle, theOther.Subtitle)) { return(false); } if (!ObjectModelHelper.IsBaseLinkIdentical(theOne.Id, theOther.Id)) { return(false); } if (!ObjectModelHelper.IsGeneratorIdentical(theOne.Generator, theOther.Generator)) { return(false); } if (!ObjectModelHelper.IsBaseLinkIdentical(theOne.Icon, theOther.Icon)) { return(false); } if (!ObjectModelHelper.IsBaseLinkIdentical(theOne.Logo, theOther.Logo)) { return(false); } return(true); }