public void OrderByEndDateListIsNull() { var OrderCriteria = new OrderByEndDateCriteria(); var actual = OrderCriteria.MeetCriteria(null); ICollection <Experience> expected = new List <Experience>(); Assert.IsTrue(expected.SequenceEqual(actual)); }
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)); }
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); }
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()); }
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)); }