[TestMethod]//??
        public void GetAllCohortsWhereAStudentOrInstructorFirstNameIsKate()
        {
            var ActualCohorts = PracticeData.Where(c => c.Students.Any(s => s.FirstName.ToLower() == "kate") || c.PrimaryInstructor.FirstName.ToLower() == "kate" || c.JuniorInstructors.Any(ji => ji.FirstName.ToLower() == "kate")).ToList();

            CollectionAssert.AreEqual(ActualCohorts, new List <Cohort> {
                CohortBuilder.Cohort1, CohortBuilder.Cohort3, CohortBuilder.Cohort4
            });
        }
        public void GetAllCohortsWhereAStudentOrInstructorFirstNameIsKate()
        {
            var ActualCohorts = PracticeData.Where(cohort => (cohort.Students.Any(student => student.FirstName == "Kate")) || (cohort.JuniorInstructors.Any(jrInstructor => jrInstructor.FirstName == "Kate")) || (cohort.PrimaryInstructor.FirstName == "Kate")).ToList();

            CollectionAssert.AreEqual(ActualCohorts, new List <Cohort> {
                CohortBuilder.Cohort1, CohortBuilder.Cohort3, CohortBuilder.Cohort4
            });
        }
        public void GetAllActiveCohorts()
        {
            List <Cohort> ActualCohorts = PracticeData.Where(cohort => cohort.Active == true).ToList(); /*FILL IN LINQ EXPRESSION*/

            CollectionAssert.AreEqual(ActualCohorts, new List <Cohort> {
                CohortBuilder.Cohort1, CohortBuilder.Cohort3
            });
        }
Esempio n. 4
0
        public void GetAllActiveCohorts()
        {
            List <Cohort> ActualCohorts = PracticeData.Where(c => { return(c.Active); }).ToList();

            CollectionAssert.AreEqual(ActualCohorts, new List <Cohort> {
                CohortBuilder.Cohort1, CohortBuilder.Cohort3
            });
        }
Esempio n. 5
0
        public void GetAllFullTimeCohorts()
        {
            List <Cohort> ActualCohorts = PracticeData.Where(cohort => cohort.FullTime) /*FILL IN LINQ EXPRESSION*/.ToList();

            CollectionAssert.AreEqual(ActualCohorts, new List <Cohort> {
                CohortBuilder.Cohort2, CohortBuilder.Cohort4
            });
        }
        public void GetAllCohortsWithThreeJuniorInstructors()
        {
            var ActualCohorts = PracticeData.Where(cohort => cohort.JuniorInstructors.Count == 3).ToList();

            CollectionAssert.AreEqual(ActualCohorts, new List <Cohort> {
                CohortBuilder.Cohort3
            });
        }
        public void GetAllCohortsWherePrimaryInstructorIsJurnell()
        {
            List <Cohort> ActualCohorts = PracticeData.Where(cohort => cohort.PrimaryInstructor.FirstName == "Jurnell").ToList();

            CollectionAssert.AreEqual(ActualCohorts, new List <Cohort> {
                CohortBuilder.Cohort1
            });
        }
        public void GetAllCohortsWhereFullTimeIsFalseAndAllInstructorsAreActive()
        {
            var ActualCohorts = PracticeData.Where(cohort => (cohort.FullTime == false) && (cohort.PrimaryInstructor.Active == true) && (cohort.JuniorInstructors.All(jrInstructor => jrInstructor.Active == true))).ToList();

            CollectionAssert.AreEqual(ActualCohorts, new List <Cohort> {
                CohortBuilder.Cohort1
            });
        }
        public void GetAllCohortsWithZacharyZohanAsPrimaryOrJuniorInstructor()
        {
            var ActualCohorts = PracticeData.Where(cohort => cohort.PrimaryInstructor.LastName == "Zohan" || cohort.JuniorInstructors.Any(jrInstructor => jrInstructor.LastName == "Zohan")).ToList();

            CollectionAssert.AreEqual(ActualCohorts, new List <Cohort> {
                CohortBuilder.Cohort2, CohortBuilder.Cohort3
            });
        }
Esempio n. 10
0
        public void GetAllCohortsWhereFullTimeIsFalseAndAllInstructorsAreActive()
        {
            var ActualCohorts = PracticeData.Where(x => x.FullTime == false && x.PrimaryInstructor.Active && x.JuniorInstructors.All(n => n.Active)).ToList();

            CollectionAssert.AreEqual(ActualCohorts, new List <Cohort> {
                CohortBuilder.Cohort1
            });
        }
Esempio n. 11
0
        public void GetAllCohortsWhereFullTimeIsFalseAndAllInstructorsAreActive()
        {
            var ActualCohorts = PracticeData.Where(cohort => !cohort.FullTime && cohort.PrimaryInstructor.Active && cohort.JuniorInstructors.All(instructor => instructor.Active)).ToList(); /*FILL IN LINQ EXPRESSION*/

            CollectionAssert.AreEqual(ActualCohorts, new List <Cohort> {
                CohortBuilder.Cohort1
            });
        }
        public void GetAllFullTimeCohorts()
        {
            List <Cohort> ActualCohorts = PracticeData.Where(cohort => cohort.FullTime == true).ToList();

            CollectionAssert.AreEqual(ActualCohorts, new List <Cohort> {
                CohortBuilder.Cohort2, CohortBuilder.Cohort4
            });
        }
Esempio n. 13
0
        public void GetAllCohortsWhereAStudentOrInstructorFirstNameIsKate()
        {
            var ActualCohorts = PracticeData.Where(x => x.Students.Any(n => n.FirstName == "Kate") ||
                                                   x.PrimaryInstructor.FirstName == "Kate" || x.JuniorInstructors.Any(k => k.FirstName == "Kate")).ToList();

            CollectionAssert.AreEqual(ActualCohorts, new List <Cohort> {
                CohortBuilder.Cohort1, CohortBuilder.Cohort3, CohortBuilder.Cohort4
            });
        }
        public void GetAllCohortsWithThreeJuniorInstructors()
        {
            //var ActualCohorts = PracticeData/*FILL IN LINQ EXPRESSION*/.ToList();
            var ActualCohorts = PracticeData.Where(c => c.JuniorInstructors.Count() == 3).ToList();

            CollectionAssert.AreEqual(ActualCohorts, new List <Cohort> {
                CohortBuilder.Cohort3
            });
        }
        public void GetAllCohortsWherePrimaryInstructorIsJurnell()
        {
            //List<Cohort> ActualCohorts = PracticeData/*FILL IN LINQ EXPRESSION*/.ToList();
            List <Cohort> ActualCohorts = PracticeData.Where(c => c.PrimaryInstructor.FirstName == "Jurnell").ToList();

            CollectionAssert.AreEqual(ActualCohorts, new List <Cohort> {
                CohortBuilder.Cohort1
            });
        }
Esempio n. 16
0
 public void GetAllCohortsWhereAStudentOrInstructorFirstNameIsKate()
 {
     //var ActualCohorts = PracticeData/*FILL IN LINQ EXPRESSION*/.ToList();
     var ActualCohorts = PracticeData
             .Where(c => (c.JuniorInstructors.Any(ji => ji.FirstName == "Kate")) ||
             (c.PrimaryInstructor.FirstName == "Kate") ||
             (c.Students.Any(s => s.FirstName == "Kate"))
             ).ToList();
     CollectionAssert.AreEqual(ActualCohorts, new List<Cohort> { CohortBuilder.Cohort1, CohortBuilder.Cohort3, CohortBuilder.Cohort4 });
 }
Esempio n. 17
0
 public void GetAllCohortsWhereFullTimeIsFalseAndAllInstructorsAreActive()
 {
    //var ActualCohorts = PracticeData/*FILL IN LINQ EXPRESSION*/.ToList();
    var ActualCohorts = PracticeData
         .Where(c => (!c.FullTime) 
         && (c.PrimaryInstructor.Active)
         && (c.JuniorInstructors.All(ji => ji.Active))
         ).ToList();
     CollectionAssert.AreEqual(ActualCohorts, new List<Cohort> { CohortBuilder.Cohort1 });
 }
Esempio n. 18
0
        public void GetAllCohortsWithZacharyZohanAsPrimaryOrJuniorInstructor()
        {
            //var ActualCohorts = PracticeData/*FILL IN LINQ EXPRESSION*/.ToList();
            var ActualCohorts = PracticeData
                                .Where(cohort => (cohort.PrimaryInstructor.FirstName == "Zachary" &&
                                                  cohort.PrimaryInstructor.LastName == "Zohan") ||
                                       cohort.JuniorInstructors
                                       .Any(junior => junior.FirstName == "Zachary" &&
                                            junior.LastName == "Zohan")
                                       ).ToList();

            CollectionAssert.AreEqual(ActualCohorts, new List <Cohort> {
                CohortBuilder.Cohort2, CohortBuilder.Cohort3
            });
        }
Esempio n. 19
0
        public void GetAllCohortsWithZacharyZohanAsPrimaryOrJuniorInstructor()
        {
            var jrInstructors = PracticeData.Where(cohort => cohort.JuniorInstructors
                                                   .Any(instructor => instructor.FirstName == "Zachary" && instructor.LastName == "Zohan"));

            var primaryInstructors = PracticeData.Where(cohort => cohort.PrimaryInstructor.FirstName == "Zachary" && cohort.PrimaryInstructor.LastName == "Zohan");
            //var ActualCohorts = PracticeData/*FILL IN LINQ EXPRESSION*/.ToList();
            // ORDER MATTERED
            // ActualCohorts = jrInstructors.Union(primaryInstructors).ToList(); ==> ERROR
            var ActualCohorts = primaryInstructors.Union(jrInstructors).ToList();

            CollectionAssert.AreEqual(ActualCohorts,
                                      new List <Cohort> {
                CohortBuilder.Cohort2, CohortBuilder.Cohort3
            });
        }
Esempio n. 20
0
        public void GetAllCohortsWhereAStudentOrInstructorFirstNameIsKate()
        {
            var studentKate          = PracticeData.Where(c => c.Students.Any(s => s.FirstName == "Kate"));
            var primaryIntructorKate = PracticeData.Where(c => c.PrimaryInstructor.FirstName == "Kate");
            var jrInstructorKate     = PracticeData.Where(c => c.JuniorInstructors.Any(ji => ji.FirstName == "Kate"));
            //var ActualCohorts = PracticeData/*FILL IN LINQ EXPRESSION*/.ToList();
            // ORDER MATTERS ...
            //var ActualCohorts = studentKate.Union(primaryIntructorKate).Union(jrInstructorKate).ToList();
            //var ActualCohorts = primaryIntructorKate.Union(studentKate).Union(jrInstructorKate).ToList();
            var ActualCohorts = jrInstructorKate.Union(studentKate).Union(primaryIntructorKate).ToList();

            CollectionAssert.AreEqual(ActualCohorts,
                                      new List <Cohort> {
                CohortBuilder.Cohort1,
                CohortBuilder.Cohort3,
                CohortBuilder.Cohort4
            });
        }
        public void DoAllStudentsInCohort1HaveFirstNamesThatContainTheLetterE()
        {
            var doAll = PracticeData.Where(c => c.Name == "Cohort Five").All(c => c.Students.All(s => s.FirstName.ToLower().Contains("e"))); //Hint: Cohort1 would be PracticeData[0]

            Assert.IsTrue(doAll);                                                                                                            //<-- change false to doAll
        }
Esempio n. 22
0
        public void DoAllActiveCohortsHavePrimaryInstructorsWithFirstNamesThatContainTheLetterA()
        {
            var doAll = PracticeData.Where(x => x.Active == true).All(n => n.PrimaryInstructor.FirstName.ToLower().Contains('a')); /*FILL IN LINQ EXPRESSION*/;

            Assert.IsFalse(doAll); //<-- change false to doAll
        }
Esempio n. 23
0
 public void GetAllCohortsWithZacharyZohanAsPrimaryOrJuniorInstructor()
 {
     var ActualCohorts = PracticeData.Where(cohort => (cohort.PrimaryInstructor.FirstName == "Zachary" &&
                                                       cohort.PrimaryInstructor.LastName == "Zohan") ||
                                            cohort.JuniorInstructors.Any(junior => (junior.FirstName == "Zachary" && junior.LastName == "Zohan")));
 }
        public void DoAllActiveCohortsHavePrimaryInstructorsWithFirstNamesThatContainTheLetterA()
        {
            var doAll = PracticeData.Where(c => c.Active).All(ca => ca.PrimaryInstructor.FirstName.ToLower().Contains('a'));

            Assert.IsFalse(doAll); //<-- change false to doAll
        }
Esempio n. 25
0
        public void GetOnlyCohortWithThreeJuniorInstructors()
        {
            var ActualCohort = PracticeData.Where(c => c.JuniorInstructors.Count == 3);

            Assert.AreEqual(ActualCohort, CohortBuilder.Cohort3);
        }
Esempio n. 26
0
        public void GetOnlyCohortThatIsFullTimeAndPrimaryInstructorBirthdayInTheFuture()
        {
            var ActualCohort = PracticeData.Where(c => c.FullTime).Where(c => c.PrimaryInstructor.Birthday.Date > DateTime.Now);

            Assert.AreEqual(ActualCohort, CohortBuilder.Cohort2);
        }