public void TestFirstTimelineRequest() { string endPoint = String.Format(endpointVerb, serviceUrl, verbDefault); HttpWebRequest request = CreateRequest(endPoint); WebResponse response = request.GetResponse(); DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(TimelineQueryResult)); TimelineQueryResult timelines = (TimelineQueryResult)serializer.ReadObject(response.GetResponseStream()); Assert.AreNotEqual <int>(0, timelines.d.Count, "No timelines returned"); Assert.AreEqual <int>(1, timelines.d.Count, "Expecting one root timeline"); }
public void TestTimelineUniqueId() { string endPoint = String.Format(endpointVerb, serviceUrl, verbDefault); HttpWebRequest request = CreateRequest(endPoint); WebResponse response = request.GetResponse(); DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(TimelineQueryResult)); TimelineQueryResult timelines = (TimelineQueryResult)serializer.ReadObject(response.GetResponseStream()); foreach (Chronozoom.Entities.Timeline timeline in timelines.d) { Assert.AreNotEqual <int>(0, timeline.UniqueID, "Timeline ID should not be 0"); } }
public void TestContentItemReferences() { string endPoint = String.Format(endpointVerb, serviceUrl, verbDefault); HttpWebRequest request = CreateRequest(endPoint); WebResponse response = request.GetResponse(); DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(TimelineQueryResult)); TimelineQueryResult timelines = (TimelineQueryResult)serializer.ReadObject(response.GetResponseStream()); foreach (Chronozoom.Entities.Timeline timeline in timelines.d) { foreach (Chronozoom.Entities.Exhibit exhibit in timeline.Exhibits) { if (exhibit.UniqueID == 118) { Assert.AreNotEqual <int>(0, exhibit.References.Count, "Expecting references"); } } } }