コード例 #1
0
 private void RemoveCohort(object Parameter)
 {
     if (SelectedCohort != null)
     {
         db.Cohorts.Remove(SelectedCohort);
         CohortList     = db.Cohorts.Local.OrderBy(c => c.Number).ThenBy(c => c.CohortDescription).ToList();
         SelectedCohort = CohortList.FirstOrDefault();
     }
 }
コード例 #2
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());
        }
コード例 #3
0
        protected async override void LoadInitalData()
        {
            CohortList = await db.Cohorts.OrderBy(c => c.Number).ThenBy(c => c.CohortDescription).ToListAsync();

            SelectedCohort = CohortList.FirstOrDefault();
        }