public List <EducationModel> GetEducations()
 {
     try
     {
         return(_educationRepository.GetEducations()
                .ToList());
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
    public async Task GetEducations()
    {
        // Arrange
        var repo = new EducationRepository();

        // Act
        var result = await repo.GetEducations();

        // Assert
        Assert.Equal(2, result.Count);
    }
예제 #3
0
        private FrontPageViewModel GetFrontPageViewModel(PageViewMode?mode)
        {
            var repo         = new PersonalInfoRepository();
            var personalInfo = repo.GetPersonalInfo();

            var eduRepo    = new EducationRepository();
            var educations = eduRepo.GetEducations();

            var expRepo    = new WorkExperienceRepository();
            var experience = expRepo.GetWorkExperience();

            var skillsRepo = new SkillsRepository();
            var skills     = skillsRepo.GetSkills();

            ViewBag.Mode = mode ?? PageViewMode.View;

            var frontPageViewModel = new FrontPageViewModel()
            {
                EducationBlock = new EducationListViewModel()
                {
                    NewEducation = new EducationViewModel()
                },
                WorkExperienceBlock = new WorkExperienceListViewModel()
                {
                    NewWorkExpirience = new WorkExperienceViewModel()
                },
                SkillCategoryBlock = new SkillsCategoryListViewModel()
                {
                    NewSkillCategory = new SkillsCategoryViewModel(),
                }
            };

            frontPageViewModel.PersonalInfo = new PersonalInfoViewModel(personalInfo);

            frontPageViewModel.EducationBlock.EducationList = educations.Select(x => new EducationViewModel(x)).ToList();
            frontPageViewModel.EducationBlock.NewEducation  = new EducationViewModel();

            frontPageViewModel.WorkExperienceBlock.WorkExperienceList = experience.Select(x => new WorkExperienceViewModel(x)).ToList();
            frontPageViewModel.WorkExperienceBlock.NewWorkExpirience  = new WorkExperienceViewModel();

            frontPageViewModel.SkillCategoryBlock.SkillsCategoryList = skills.Select(x => new SkillsCategoryViewModel(x)).ToList();
            frontPageViewModel.SkillCategoryBlock.NewSkillCategory   = new SkillsCategoryViewModel();

            return(frontPageViewModel);
        }