コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="StudentCourseEvaluation" /> class.
        /// </summary>
        /// <param name="student">The student.</param>
        /// <param name="evaluation">The evaluation.</param>
        /// <exception cref="System.ArgumentNullException">if student is null.</exception>
        public StudentCourseEvaluation(Student student, CourseEvaluation evaluation = null)
        {
            if (student == null)
                throw new ArgumentNullException("student");

            this.Student = student;
            this.Evaluation = evaluation ?? new CourseEvaluation();
        }
コード例 #2
0
ファイル: StudentTest.cs プロジェクト: besoft/NETProject
        public void TestStudent()
        {
            var st = new Student("1234", "Anna", "Nova");
            Assert.AreEqual("1234", st.PersonalNumber);
            Assert.AreEqual("Anna", st.FirstName);
            Assert.AreEqual("Nova", st.Surname);

            Assert.AreEqual("NOVA Anna", st.FullName);
            Assert.AreEqual("1234\tNOVA Anna", st.ToString());
        }
コード例 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="StudentCourseEvaluation" /> class.
        /// </summary>
        /// <param name="student">The student.</param>
        /// <param name="evalDefinition">The eval definition.</param>
        /// <exception cref="System.ArgumentNullException">if student is null.</exception>
        public StudentCourseEvaluation(Student student, EvaluationDefinitionCollection evalDefinition)
        {
            if (student == null)
                throw new ArgumentNullException("student");
            if (evalDefinition == null)
                throw new ArgumentNullException("evalDefinition");

            this.Student = student;
            this.Evaluation = new CourseEvaluation(evalDefinition);
        }
コード例 #4
0
        public void TestRemovingStudents()
        {
            var st = new Student("1234", "Anna", "Nova");

            var scol = new StudentCourseEvaluationCollection();
            Assert.AreEqual(-1, scol.IndexOf(st));
            Assert.AreEqual(false, scol.Contains(st));
            Assert.AreEqual(false, scol.Remove(st));

            scol.Add(st);
            Assert.AreEqual(0, scol.IndexOf(st));
            Assert.AreEqual(true, scol.Contains(st));
            Assert.AreEqual(true, scol.Remove(st));
            Assert.AreEqual(0, scol.Count);

            scol.Add("2435", "Bara", "Nova");
            scol.Add(st);
            Assert.AreEqual(1, scol.IndexOf(st));
            Assert.AreEqual(true, scol.Contains(st));
            Assert.AreEqual(true, scol.Remove(st));
            Assert.AreEqual(1, scol.Count);
        }