// GET: Updater public ActionResult Run() { var db = new DataContext(); var rssReaderService = new RssReaderService(); var updater = new FeedsUpdaterService(rssReaderService, db); db.DeleteShows(); db.ActiveProducers() .AsQueryable() .ToList() .ForEach(p => { updater.Update(p); }); return RedirectToAction("index","home"); }
public void WillUpdateDB() { var db = new DataContext(); var rssReaderService = new RssReaderService(); var updater = new FeedsUpdaterService(rssReaderService, db); db.DeleteShows(); db.Producers.AsQueryable() .ToList() .ForEach(p => { updater.Update(p); }); Assert.IsTrue(db.Shows.Count() > 0); Console.WriteLine("Shows count: " + db.Shows.Count()); Assert.IsTrue(db.Shows.Count() > 0); }