예제 #1
0
        public void RemoverRemoveCourseGrade_ValidParameters_CourseGradeRemoved()
        {
            // Arrange
            Creator.CreateCourse(Instances.Name, Instances.Description);
            Course course = Course.GetByID(1);

            Creator.CreateCourseGrade(course, Instances.Student, Instances.Grade, Instances.Comment);
            CourseGrade courseGrade = CourseGrade.GetByID(1);

            // Act
            Remover.RemoveCourseGrade(courseGrade);

            // Assert
            Assert.AreEqual(0, course.CourseGrades.Count);
            Assert.AreEqual(0, CourseGrade.GetAll().Count);
        }
예제 #2
0
        public void RemoverRemoveCourseGrade_ValidParameters_CourseGradeRemoved()
        {
            // Arrange
            var courseGrade   = CourseGrade.New(Instances.Course, Instances.Student, Instances.Grade, Instances.Comment);
            var courseGradeid = courseGrade.ID;

            // Act
            courseGrade.Remove();

            // Assert
            try
            {
                CourseGrade.GetByID(courseGradeid);
                Assert.Fail();
            }
            catch (InvalidIDException) { }
        }
예제 #3
0
        public ActionResult Index(int id)
        {
            //Test
            Session["user"] = Student.GetByConditions("name='Iver Clausen'").Single();
            //Actual
            Person      person = (Person)Session["user"];
            CourseGrade currentGrade;

            if (person == null)
            {
                try
                {
                    currentGrade = CourseGrade.GetByID(Convert.ToUInt32(id));
                }
                catch (InvalidIDException)
                {
                    return(RedirectToAction("Index", "Login"));
                }
            }
            return(RedirectToAction("Index", "News"));
        }