Exemple #1
0
 public ActionResult Index(FeedViewModel viewModel)
 {
     var feed = new AtomFeed(viewModel.Url) { Reader = this.Reader };
     feed.PopulateEntries();
     var entriesViewModel = new PopulateFeedViewModel();
     entriesViewModel.Entries.AddRange(feed.Entries.Select(entry => new FeedEntryViewModel { Title = entry.Title }).ToList());
     return this.View(entriesViewModel);
 }
Exemple #2
0
 public void PostIndexActionShouldReturnViewModelWithListOfEntries()
 {
     var viewModel = new FeedViewModel { Url = "http://mysample.com/" };
     var result = this.controller.Index(viewModel) as ViewResult;
     var model = result.Model as PopulateFeedViewModel;
     Assert.IsNotNull(result);
     Assert.IsNotNull(model);
     Assert.AreEqual(3, model.Entries.Count);
 }