Esempio n. 1
0
        public IEnumerable <LecturerDTO> GetLecturers()
        {
            var Lecturers = lecturerRepo.FindAll();
            List <LecturerDTO> LecturerDTOs = new List <LecturerDTO>();

            Mapper.Initialize(c => c.CreateMap <DbSet <Lecturer>, List <LecturerDTO> >());
            LecturerDTOs = Mapper.Map <List <LecturerDTO> >(Lecturers);

            return(LecturerDTOs);
        }
Esempio n. 2
0
        public void FindLecturers_ValidCall()
        {
            Mock <ILecturerRepository> mockStudentRepository = MockLecturerRepository;

            mockStudentRepository.Setup(mr => mr.FindAll()).Returns(GetSampleLecturers());
            _mockLecturerRepository = mockStudentRepository.Object;


            IEnumerable <LecturerModel> Grades = _mockLecturerRepository.FindAll();

            Assert.True(Grades != null);                                   // Test if null
            Assert.AreEqual(GetSampleLecturers().Count(), Grades.Count()); // Verify the correct Number
        }
Esempio n. 3
0
 public IEnumerable <LecturerModel> FindAllLecturers()
 {
     return(_lecturerRepository.FindAll());
 }