Exemplo n.º 1
0
        public void TestAddMark_AddMoreThan20_ShouldThrowArgumentOutOfRangeException()
        {
            var mockedMark = new Mock<IMark>();
            mockedMark.Setup(x => x.Subject).Returns(It.IsAny<Subject>());
            mockedMark.Setup(x => x.Value).Returns(It.IsAny<float>());

            var student = new Student("Gosho", "Peshev", Grade.Ninth);

            student.AddMark(mockedMark.Object);
            student.AddMark(mockedMark.Object);
            student.AddMark(mockedMark.Object);
            student.AddMark(mockedMark.Object);
            student.AddMark(mockedMark.Object);
            student.AddMark(mockedMark.Object);
            student.AddMark(mockedMark.Object);
            student.AddMark(mockedMark.Object);
            student.AddMark(mockedMark.Object);
            student.AddMark(mockedMark.Object);
            student.AddMark(mockedMark.Object);
            student.AddMark(mockedMark.Object);
            student.AddMark(mockedMark.Object);
            student.AddMark(mockedMark.Object);
            student.AddMark(mockedMark.Object);
            student.AddMark(mockedMark.Object);
            student.AddMark(mockedMark.Object);
            student.AddMark(mockedMark.Object);
            student.AddMark(mockedMark.Object);
            student.AddMark(mockedMark.Object);

            Assert.Throws<ArgumentOutOfRangeException>(() => student.AddMark(mockedMark.Object));
        }
Exemplo n.º 2
0
        public void TestListMarks_EmptyMarksList_ShouldReturnCorrectString()
        {
            var student = new Student("Gosho", "Peshev", Grade.Ninth);

            var actual = student.ListMarks();
            var expected = "The student has no marks.\r\n";

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 3
0
        public void TestAddMark_ShouldAddCorrectly()
        {
            var mockedMark = new Mock<IMark>();
            mockedMark.Setup(x => x.Subject).Returns(It.IsAny<Subject>());
            mockedMark.Setup(x => x.Value).Returns(It.IsAny<float>());

            var student = new Student("Gosho", "Peshev", Grade.Ninth);

            student.AddMark(mockedMark.Object);

            var result = student.Marks.Count;

            Assert.AreEqual(1, result);
        }
Exemplo n.º 4
0
        public void TestListMarks_ShourdReturnCorrectString()
        {
            var mockedMark = new Mock<IMark>();
            mockedMark.Setup(x => x.Subject).Returns(It.IsAny<Subject>());
            mockedMark.Setup(x => x.Value).Returns(It.IsAny<float>());

            var student = new Student("Gosho", "Peshev", Grade.Ninth);

            student.AddMark(mockedMark.Object);

            var result = student.ListMarks();

            Assert.IsTrue(result.Contains("The student has these marks:"));
        }
Exemplo n.º 5
0
 public static void AddStudent(int id, Student student)
 {
     Students.Add(id, student);
 }