예제 #1
0
        public void ShouldListAllTagsDescByCounters()
        {
            Events newEvents = new Events
            {
                {new Event ("2015/01/01", "#tag","description") },
                {new Event("2015/11/15", "title @Ioana","#desc") },
                {new Event("2015/11/15","new tag","@Ioana") },
                {new Event("2015/11/15","#tag","#desc @Ioana test" ) }
            };
            Tag[] expectedTagList = {
                new Tag("@Ioana",3),
                new Tag("#tag",2),
                new Tag("#desc",2)
                 };

            var tagList = new TagsCounter(newEvents);

            tagList.SortTagsDescByCount();
            var tags = tagList.TagList;
            AreEquals(tags, expectedTagList);
        }
예제 #2
0
        public void ShouldListAllTagsAscByName()
        {
            Events newEvents = new Events
            {
                { new Event("2015/01/01", "#tag", "description") },
                { new Event("2015/11/15", "title @Ioana", "#desc") },
                { new Event("2015/11/15", "new tag", "@Ioana") },
                { new Event("2015/11/15", "#tag", "#desc @Ioana test") }
            };

            Tag[] expectedTagList =
            {
                new Tag("#desc",  2),
                new Tag("#tag",   2),
                new Tag("@Ioana", 3)
            };

            var tagList = new TagsCounter(newEvents);

            tagList.SortTagsAscByName();
            var tags = tagList.TagList;

            AreEquals(tags, expectedTagList);
        }
예제 #3
0
 public static void ListAllTags(string sort)
 {
     TXTFile files = new TXTFile();
     Events eventsList = files.LoadEventsFromFile();
     TagsCounter tags= new TagsCounter(eventsList);
     switch (sort)
     {
         case "byCount":
             {
                 tags.SortTagsDescByCount();
                 break;
             }
         case "byName":
             {
                 tags.SortTagsAscByName();
                 break;
             }
     }
     Tag[] listTodispaly = tags.TagList.ToArray();
     new IOConsole().DisplayTagsAndCountersToConsole(listTodispaly);
 }