Example #1
0
        public void OrderByEndDateListIsNull()
        {
            var OrderCriteria = new OrderByEndDateCriteria();
            var actual        = OrderCriteria.MeetCriteria(null);
            ICollection <Experience> expected = new List <Experience>();

            Assert.IsTrue(expected.SequenceEqual(actual));
        }
Example #2
0
        public void OrderByEndDateWorksWithEmptyList()
        {
            ICollection <Experience> emptyList = new List <Experience>();
            var OrderCriteria = new OrderByEndDateCriteria();
            var actual        = OrderCriteria.MeetCriteria(emptyList);
            ICollection <Experience> expected = new List <Experience>();

            Assert.IsTrue(expected.SequenceEqual(actual));
        }
Example #3
0
        public List <GroupedExperienceAndCategory> GetEducations()
        {
            var educationCriteria      = new EducationCriteria();
            var orderByEndDateCriteria = new OrderByEndDateCriteria();
            var bothCriteria           = new AndCriteria(educationCriteria, orderByEndDateCriteria);
            var listOfEducations       = bothCriteria.MeetCriteria(Experience);

            var listofGroupedExperienceAndCategories = new List <GroupedExperienceAndCategory>()
            {
                new GroupedExperienceAndCategory("Uddannelse", listOfEducations.ToList())
            };

            return(listofGroupedExperienceAndCategories);
        }
Example #4
0
        public List <GroupedExperienceAndCategory> GetExperiencesWithoutEducation()
        {
            var orderByDateCriteria         = new OrderByEndDateCriteria();
            var experiencesWithoutEducation = Experience.Where(exp => exp.Category.Category != "Uddannelse");

            var groupedAndOrdered = experiencesWithoutEducation.GroupBy(
                exp => exp.Category,
                (category, experiences) => new GroupedExperienceAndCategory(
                    category.Category,
                    orderByDateCriteria.MeetCriteria(experiences.ToList()).ToList()
                    )
                );

            return(groupedAndOrdered.OrderBy(
                       exp => experiencesWithoutEducation.First
                       (
                           cat => cat.Category.Category == exp.Name
                       ).Category.Order).ToList());
        }
Example #5
0
        public void OrderByEndDateListOrderedList()
        {
            ICollection <Experience> unorderedList = new List <Experience>();
            var experience1 = new Experience("test",
                                             "test",
                                             new System.DateTime(2020, 01, 01),
                                             new System.DateTime(2020, 02, 01));
            var experience2 = new Experience("test",
                                             "test",
                                             new System.DateTime(2019, 01, 01),
                                             new System.DateTime(2019, 02, 01));

            unorderedList.Add(experience1);
            unorderedList.Add(experience2);
            var OrderCriteria = new OrderByEndDateCriteria();
            var actual        = OrderCriteria.MeetCriteria(unorderedList);
            ICollection <Experience> expected = new List <Experience>();

            expected.Add(experience1);
            expected.Add(experience2);
            Assert.IsTrue(expected.SequenceEqual(actual));
        }