Exemplo n.º 1
0
        public void SetUpMocks()
        {
            var cohortQueryable     = CohortList.AsQueryable();
            var studentQueryable    = StudentList.AsQueryable();
            var instructorQueryable = InstructorList.AsQueryable();

            MockCohorts.As <IQueryable <Cohort> >().Setup(c => c.Provider).Returns(cohortQueryable.Provider);
            MockCohorts.As <IQueryable <Cohort> >().Setup(c => c.Expression).Returns(cohortQueryable.Expression);
            MockCohorts.As <IQueryable <Cohort> >().Setup(c => c.ElementType).Returns(cohortQueryable.ElementType);
            MockCohorts.As <IQueryable <Cohort> >().Setup(c => c.GetEnumerator()).Returns(() => cohortQueryable.GetEnumerator());

            MockStudents.As <IQueryable <Student> >().Setup(s => s.Provider).Returns(studentQueryable.Provider);
            MockStudents.As <IQueryable <Student> >().Setup(s => s.Expression).Returns(studentQueryable.Expression);
            MockStudents.As <IQueryable <Student> >().Setup(s => s.ElementType).Returns(studentQueryable.ElementType);
            MockStudents.As <IQueryable <Student> >().Setup(s => s.GetEnumerator()).Returns(() => studentQueryable.GetEnumerator());

            MockInstructors.As <IQueryable <Instructor> >().Setup(i => i.Provider).Returns(instructorQueryable.Provider);
            MockInstructors.As <IQueryable <Instructor> >().Setup(i => i.Expression).Returns(instructorQueryable.Expression);
            MockInstructors.As <IQueryable <Instructor> >().Setup(i => i.ElementType).Returns(instructorQueryable.ElementType);
            MockInstructors.As <IQueryable <Instructor> >().Setup(i => i.GetEnumerator()).Returns(() => instructorQueryable.GetEnumerator());
        }