Exemple #1
0
 public void CallbackOfPressMethodWillBeCalled()
 {
     bool calledBack = false;
     List<News> res = new List<News>();
     var sut = new Press();
     sut.RaiseRetreivedNewsItems += (sender, e) =>
     {
         calledBack = true;
         res = e.News;
     };
     sut.FireEventForNews();
     for (int i = 0; (i < 10) && !calledBack; i++)
     {
         Thread.Sleep(1000);
     }
     Assert.IsTrue(res.Count > 1);
 }
Exemple #2
0
 private void ReachToPress()
 {
 _press = new Press();
 _fetcher.RaiseRetreivedNewsItem += (sender, e) =>
 {
     AddNewsEntry(e.News);
 };
 try
 {
     _fetcher.GetTimes((int)_settings.Read("group") + 1, Activity.GetNews);
 }
 catch
 {
     _fetcher.GetTimes(5, Activity.GetNews);
 }
 _news = new ObservableCollection<News>();
 _press.RaiseRetreivedNewsItems += (sender, e) =>
 {
     AddNewsEntrys(e.News);
 };
 _press.FireEventForNews();
 Newspanel.DataContext = _news;
 }