Exemplo n.º 1
0
 public void ContainsStory()
 {
     var set = new Set<Story>();
     var story = new Story(new FrontpageItem { Title = "title", Link = "blah" });
     set.Add(story);
     Assert.True(set.Contains(story));
 }
Exemplo n.º 2
0
 public void Notify(Story story)
 {
     var frontpageItem = story.Item;
     var notification = new Notification(ApplicationName, NotificationTypeName, "ID", frontpageItem.Title, frontpageItem.Link);
     var callback = new CallbackContext(frontpageItem.Link);
     _growl.Notify(notification, callback);
 }
Exemplo n.º 3
0
 public void TrimTwo()
 {
     var set = new OrderedSet<Story>();
     var story = new Story(new FrontpageItem { Title = "title", Link = "blah" }) { DisplayTime = DateTime.Now};
     var story2 = new Story(new FrontpageItem { Title = "title2", Link = "blah" }) {DisplayTime = DateTime.MinValue};
     set.Add(story);
     set.Add(story2);
     set.Trim(2);
     Assert.AreEqual(2, set.Count);
 }
Exemplo n.º 4
0
 public void ContainsStoryTwoAddsHaveDifferentTimes()
 {
     var set = new Set<Story>();
     var story = new Story(new FrontpageItem { Title = "title", Link = "blah", Description = "shouldnt matter" });
     var story2 = new Story(new FrontpageItem { Title = "title", Link = "blah", Description = "diff but irrelevant" });
     set.Add(story);
     set.Add(story2);
     Assert.True(set.Contains(story));
     Assert.True(set.Contains(story2));
 }
Exemplo n.º 5
0
 public void Trim()
 {
     var story = new Story(new FrontpageItem { Title = "title", Link = "blah", Description = "shouldnt matter" });
     var story2 = new Story(new FrontpageItem { Title = "title", Link = "blah", Description = "diff but irrelevant" });
     var story3 = new Story(new FrontpageItem { Title = "title", Link = "blah", Description = "diff but irrelevant" });
     var list = new List<Story> { story, story2, story3 };
     list.Trim(2);
     Assert.AreEqual(2, list.Count);
     Assert.Contains(story, list);
     Assert.Contains(story2, list);
 }
Exemplo n.º 6
0
 public void Trim()
 {
     var set = new OrderedSet<Story>();
     var story = new Story(new FrontpageItem { Title = "title", Link = "blah", Description = "shouldnt matter" }) { DisplayTime = DateTime.Now};
     var story2 = new Story(new FrontpageItem { Title = "title", Link = "blah", Description = "diff but irrelevant" }) {DisplayTime = DateTime.MinValue};
     set.Add(story);
     set.Add(story2);
     set.Trim(1);
     Assert.AreEqual(1, set.Count);
     Assert.AreEqual(story2, set[0]);
 }
Exemplo n.º 7
0
 public void OrderedSetTest()
 {
     var set = new OrderedSet<Story>();
     var story = new Story(new FrontpageItem { Title = "title", Link = "blah", Description = "shouldnt matter" });
     var story2 = new Story(new FrontpageItem { Title = "title", Link = "blah", Description = "diff but irrelevant" });
     set.Add(story);
     set.Add(story2);
     set.RemoveLast();
     Assert.AreEqual(1, set.Count);
     Assert.AreEqual(story2, set[0]);
 }
Exemplo n.º 8
0
 public void TrimLarger()
 {
     var set = new OrderedSet<Story>();
     var story = new Story(new FrontpageItem { Title = "title", Link = "blah", Description = "shouldnt matter" }) { DisplayTime = DateTime.Now};
     var story2 = new Story(new FrontpageItem { Title = "title2", Link = "blah", Description = "diff but irrelevant" }) {DisplayTime = DateTime.MinValue};
     var story3 = new Story(new FrontpageItem { Title = "title3", Link = "blah", Description = "diff but irrelevant" }) {DisplayTime = DateTime.MinValue};
     var story4 = new Story(new FrontpageItem { Title = "title4", Link = "blah", Description = "diff but irrelevant" }) {DisplayTime = DateTime.MinValue};
     var story5 = new Story(new FrontpageItem { Title = "title5", Link = "blah", Description = "diff but irrelevant" }) {DisplayTime = DateTime.MinValue};
     var story6 = new Story(new FrontpageItem { Title = "title6", Link = "blah", Description = "diff but irrelevant" }) {DisplayTime = DateTime.MinValue};
     var story7 = new Story(new FrontpageItem { Title = "title7", Link = "blah", Description = "diff but irrelevant" }) {DisplayTime = DateTime.MinValue};
     set.Add(story);
     set.Add(story2);
     set.Add(story3);
     set.Add(story4);
     set.Add(story5);
     set.Add(story6);
     set.Add(story7);
     set.Trim(3);
     Assert.AreEqual(3, set.Count);
 }