public FeedCompleted ( IFeed feed, int itemCount ) : System.Web.Mvc.JsonResult | ||
feed | IFeed | |
itemCount | int | |
Результат | System.Web.Mvc.JsonResult |
public void FeedCompletedShouldReturnValidJsonObject() { var controller = new FeedController(_factory); IFeed feed = null; var serializer = new JavaScriptSerializer(); JsonResult expected = null; JsonResult actual; if (_factory.PingFeed(new Uri(Feeduri))) { feed = _factory.CreateFeed(new Uri(Feeduri)); var jsonExpected = serializer.Serialize(FeedSummarizer.SummarizeFeed(feed, ItemCount)); Assert.IsNotNull(feed); Assert.AreEqual(Feeduri, feed.FeedUri.AbsoluteUri); actual = controller.FeedCompleted(feed, ItemCount); var jsonActual = serializer.Serialize(actual.Data); //The Guid ids are going to be different, but the lengths of the response should be the same Assert.AreEqual(jsonExpected.Length, jsonActual.Length); Assert.IsTrue(jsonActual.Length > 0); //Double check to see that we didn't manage to serialize anything } else { Assert.Inconclusive(string.Format("Unable to ping feed at uri {0}", Feeduri)); } }