public void TestGetProfessors2()
        {
            var db = AddProfessor2();

            AdministratorController controller = new AdministratorController();

            controller.UseLMSContext(db);

            var result = controller.GetProfessors("EE") as JsonResult;

            dynamic jdata = result.Value;

            Assert.Equal(2, jdata.Length);

            var query = from p in db.Professors
                        select p;

            Assert.Equal("Ron", query.ToArray()[0].FName);
            Assert.Equal("Weasley", query.ToArray()[0].LName);
            Assert.Equal("u0000000", query.ToArray()[0].UId);
            Assert.Equal("EE", query.ToArray()[0].WorksIn);
            Assert.Contains("9/22/1994", query.ToArray()[0].Dob.ToString());

            Assert.Equal("Kanny", query.ToArray()[1].FName);
            Assert.Equal("Dopta", query.ToArray()[1].LName);
            Assert.Equal("u0000001", query.ToArray()[1].UId);
            Assert.Equal("EE", query.ToArray()[1].WorksIn);
            Assert.Contains("10/23/1992", query.ToArray()[1].Dob.ToString());
        }
        public void CanGetProfessorInCSDepartment()
        {
            AdministratorController admin = new AdministratorController();
            Team55LMSContext        db    = MakeProfessors();

            admin.UseLMSContext(db);

            var     professors = admin.GetProfessors("CS") as JsonResult;
            dynamic result     = professors.Value;

            var csProfessors = from pro in db.Professors
                               where pro.Department == "CS"
                               select pro;

            Assert.Equal("{ lname = Kopta, fname = Daniel, uid = u0000001 }", result[0].ToString());
            Assert.Equal(1, csProfessors.Count());
        }
        public void CanGetProfessorsInLinguisticsDepartment()
        {
            AdministratorController admin = new AdministratorController();
            Team55LMSContext        db    = MakeProfessors();

            admin.UseLMSContext(db);

            var     professors = admin.GetProfessors("LING") as JsonResult;
            dynamic result     = professors.Value;

            var lingProfessors = from pro in db.Professors
                                 where pro.Department == "LING"
                                 select pro;

            Assert.Equal("{ lname = Eggert, fname = Randall, uid = u0000002 }", result[0].ToString());
            Assert.Equal("{ lname = Paul Vooge, fname = Nathan, uid = u0000003 }", result[1].ToString());
            Assert.Equal(2, lingProfessors.Count());
        }
        public void CanGetProfessorsInMathematicsDepartment()
        {
            AdministratorController admin = new AdministratorController();
            Team55LMSContext        db    = MakeProfessors();

            admin.UseLMSContext(db);

            var     professors = admin.GetProfessors("MATH") as JsonResult;
            dynamic result     = professors.Value;

            var mathProfessors = from pro in db.Professors
                                 where pro.Department == "MATH"
                                 select pro;

            Assert.Equal("{ lname = McArthur, fname = Kelly, uid = u0000004 }", result[0].ToString());
            Assert.Equal("{ lname = Cecil, fname = Matthew, uid = u0000005 }", result[1].ToString());
            Assert.Equal("{ lname = Rowland, fname = Ashley, uid = u0000006 }", result[2].ToString());
            Assert.Equal(3, mathProfessors.Count());
        }
        public void TestGetProfessors()
        {
            var db = AddProfessor();

            AdministratorController controller = new AdministratorController();

            controller.UseLMSContext(db);

            var result = controller.GetProfessors("CS") as JsonResult;

            dynamic jdata = result.Value;

            Assert.Equal(1, jdata.Length);


            var query = from p in db.Professors
                        select p;

            Assert.Equal("John", query.ToArray()[0].FName);
            Assert.Equal("Doe", query.ToArray()[0].LName);
            Assert.Equal("u0000000", query.ToArray()[0].UId);
            Assert.Equal("CS", query.ToArray()[0].WorksIn);
            Assert.Contains("10/23/1997", query.ToArray()[0].Dob.ToString());
        }