Exemplo n.º 1
0
        public void CannotCreateDuplicateAssignment()
        {
            ProfessorController prof = new ProfessorController();
            Team55LMSContext    db   = MakeDatabaseWithOneAssignment();

            prof.UseLMSContext(db);

            string   category = "Assignments";
            string   name     = "One Problem";
            DateTime due      = DateTime.Parse("12/01/2020 11:59:59");
            string   contents = "Just compute the indefinite integral on problem 2, page 303 :)";

            var     duplicate = prof.CreateAssignment("MATH", 2210, "Summer", 2020, category, name, 10, due, contents) as JsonResult;
            dynamic result    = duplicate.Value;

            Assert.Equal("{ success = False }", result.ToString());
        }
Exemplo n.º 2
0
        public void CanCreateAssignment()
        {
            ProfessorController prof = new ProfessorController();
            Team55LMSContext    db   = MakeDatabaseWithNoAssignments();

            prof.UseLMSContext(db);

            string   aName    = "Homework 1";
            string   category = "Assignments";
            string   contents = "Compute gradients for problems 1-20";
            DateTime due      = DateTime.Parse("04/20/2020 11:59:59");

            var     createAssignment = prof.CreateAssignment("MATH", 2210, "Summer", 2020, category, aName, 100, due, contents) as JsonResult;
            dynamic result           = createAssignment.Value;

            Assert.Equal("{ success = True }", result.ToString());
        }