コード例 #1
0
ファイル: AddMarkTests.cs プロジェクト: cwetanow/Telerik
        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));
        }
コード例 #2
0
ファイル: ListMarksTests.cs プロジェクト: cwetanow/Telerik
        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);
        }
コード例 #3
0
ファイル: AddMarkTests.cs プロジェクト: cwetanow/Telerik
        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);
        }
コード例 #4
0
ファイル: ListMarksTests.cs プロジェクト: cwetanow/Telerik
        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:"));
        }
コード例 #5
0
ファイル: Engine.cs プロジェクト: cwetanow/Telerik
 public static void AddStudent(int id, Student student)
 {
     Students.Add(id, student);
 }