///////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// /// <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>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); }