Exemple #1
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);
        }
Exemple #2
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:"));
        }
Exemple #3
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));
        }