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)); }
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); }
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); }
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:")); }
public static void AddStudent(int id, Student student) { Students.Add(id, student); }