diff --git a/Exam/Solution/Exam/SchoolSystem.Tests/Extensions/MoqExtensions.cs b/Exam/Solution/Exam/SchoolSystem.Tests/Extensions/MoqExtensions.cs index 5a1b9f5..d7a2d9b 100644 --- a/Exam/Solution/Exam/SchoolSystem.Tests/Extensions/MoqExtensions.cs +++ b/Exam/Solution/Exam/SchoolSystem.Tests/Extensions/MoqExtensions.cs @@ -11,6 +11,14 @@ public static void SetupMany(this Mock mock, params TReturn[] args) where TSvc : class { + if (args.Length == 0) + { + mock.Setup(expression) + .Returns(null); + + return; + } + var numCalls = 0; mock.Setup(expression) diff --git a/Exam/Solution/Exam/SchoolSystem.Tests/Models/StudentTests.cs b/Exam/Solution/Exam/SchoolSystem.Tests/Models/StudentTests.cs index a393b54..b4d9a73 100644 --- a/Exam/Solution/Exam/SchoolSystem.Tests/Models/StudentTests.cs +++ b/Exam/Solution/Exam/SchoolSystem.Tests/Models/StudentTests.cs @@ -14,14 +14,15 @@ public void Constructor_ShouldSetGradeProperty_WhenInitialized() { var expectedGrade = Grade.Fifth; var student = new Student("Pesho", "Peshov", expectedGrade); - Assert.That(student.Grade == expectedGrade); + Assert.AreEqual(expectedGrade, student.Grade); } [Test] public void Constructor_ShouldSetInstanceToMarksCollectionProperty_WhenInitialized() { var student = new Student("Pesho", "Peshov", Grade.Fifth); - Assert.That(student.Marks != null); + Assert.AreNotEqual(null, student.Marks); + } [Test] diff --git a/Exam/Solution/Exam/SchoolSystem.Tests/Models/TeacherTests.cs b/Exam/Solution/Exam/SchoolSystem.Tests/Models/TeacherTests.cs index 7185876..be91135 100644 --- a/Exam/Solution/Exam/SchoolSystem.Tests/Models/TeacherTests.cs +++ b/Exam/Solution/Exam/SchoolSystem.Tests/Models/TeacherTests.cs @@ -17,7 +17,7 @@ public void Constructor_ShouldSetSubjectProperty_WhenInitialized() { var expectedSubject = Subject.Bulgarian; var teacher = new Teacher("Pesho", "Peshov", expectedSubject); - Assert.That(teacher.Subject == expectedSubject); + Assert.AreEqual(expectedSubject, teacher.Subject); } [TestCase("P", "Goshev")] @@ -45,8 +45,8 @@ public void AddMark_ShouldAddMarkToThePassedStudent_WhenPassedMarkIsValid() teacher.AddMark(student.Object, expectedValue); - Assert.That(student.Object.Marks.Single().Subject == expectedSubject); - Assert.That(student.Object.Marks.Single().Value == expectedValue); + Assert.AreEqual(expectedSubject, student.Object.Marks.Single().Subject); + Assert.AreEqual(expectedValue, student.Object.Marks.Single().Value); } [Test]