Example #1
0
        static void Main(string[] args)
        {
            var postList = new PostList();

            postList[0] = new Post {
                Title = "Bad Post", Description = "Post1 Description"
            };
            postList[1] = new Post {
                Title = "Okay Post", Description = "Post2 Description"
            };
            postList[2] = new Post {
                Title = "Really Awesome Post", Description = "Post3 Description"
            };
            DisplayPosts();
            postList["Really Awesome Post"].UpVote();
            postList["Okay Post"].UpVote();
            postList["Bad Post"].DownVote();
            DisplayPosts();
            postList["Really Awesome Post"].UpVote();
            postList["Okay Post"].DownVote();
            postList["Bad Post"].DownVote();
            DisplayPosts();
            postList[3] = new Post {
                Title = "Okay Late Post", Description = "Post4 Description"
            };
            postList["Really Awesome Post"].UpVote();
            postList["Okay Post"].UpVote();
            postList["Bad Post"].DownVote();
            DisplayPosts();
        }
Example #2
0
 public void DownVote()
 {
     this.Votes--;
     PostList.SortList();
 }
Example #3
0
 public void UpVote()
 {
     this.Votes++;
     PostList.SortList();
 }