public FeedAsync ( string feeduri, int itemCount ) : void | ||
feeduri | string | |
itemCount | int | |
리턴 | void |
public void CanQueryFeedsInBulk() { var controller = new FeedController(_factory); var waitHandle = new AutoResetEvent(false); IFeedLocationService locationService = new FakeFeedLocationService(); // Create and attach event handler for the "Finished" event EventHandler eventHandler = (sender, e) => waitHandle.Set(); controller.AsyncManager.Finished += eventHandler; foreach(var item in locationService.GetFeeds()) { if (_factory.PingFeed(item)) { controller.FeedAsync(item.AbsoluteUri, ItemCount); const int msTimeout = 5000; if (!waitHandle.WaitOne(msTimeout, false)) { Assert.Fail("Test timed out."); } var response = controller.AsyncManager.Parameters["feed"] as IFeed; Assert.IsNotNull(response); Assert.AreEqual(item.AbsoluteUri, response.FeedUri.AbsoluteUri); var summary = FeedSummarizer.SummarizeFeed(response, ItemCount); Assert.AreEqual(summary.Items.Count, ItemCount); } else { Assert.Inconclusive(string.Format("Unable to ping feed at uri {0}", item)); } } }
public void FeedAsyncMethodShouldPopulateAsyncParameters() { var controller = new FeedController(_factory); var waitHandle = new AutoResetEvent(false); // Create and attach event handler for the "Finished" event EventHandler eventHandler = (sender, e) => waitHandle.Set(); controller.AsyncManager.Finished += eventHandler; if(_factory.PingFeed(new Uri(Feeduri))) { controller.FeedAsync(Feeduri, ItemCount); const int msTimeout = 5000; if (!waitHandle.WaitOne(msTimeout, false)) { Assert.Fail("Test timed out."); } var response = controller.AsyncManager.Parameters["feed"] as IFeed; Assert.IsNotNull(response); Assert.AreEqual(Feeduri, response.FeedUri.AbsoluteUri); Assert.IsTrue(response.Items.Count() > 0); } else { Assert.Inconclusive(string.Format("Unable to ping feed at uri {0}", Feeduri)); } }