Beispiel #1
0
        /// <summary>
        /// Метод для получения списка опыта. Позволяет преобразовать Experience в SelectListItem
        /// для дальнейшей работы
        /// </summary>
        /// <returns></returns>
        public List <SelectListItem> GetExperienceLists()
        {
            List <SelectListItem> listItems = new List <SelectListItem>();

            foreach (var e in experienceRepository.GetAll())
            {
                SelectListItem item = new SelectListItem
                {
                    Text  = e.Skill,
                    Value = e.Id.ToString()
                };
                listItems.Add(item);
            }
            return(listItems);
        }
Beispiel #2
0
        public void ExperienceRepository_GetAll_Works()
        {
            var originalList = new List <IExperienceEntity>();

            for (int i = 0; i < 42; i++)
            {
                var item = new ExperienceEntity();
                item.Employer = "test";
                originalList.Add(item);
            }
            var mockXml    = new Mock <IExperienceXMLService>();
            var mockKernel = new Mock <IKernel>();

            mockXml.Setup(T => T.GetAll()).Returns(originalList);
            var repos = new ExperienceRepository(mockXml.Object, new VitaeNinjectKernel());

            var list = repos.GetAll();

            Assert.IsNotNull(list);
            Assert.AreEqual(42, list.Count);
            Assert.IsTrue(list.All(T => T.Employer == "test"));
        }