public TestResult(string testName, int resultPoints, GradingOutcomes gradingOutcome, string?description) { this.TestName = string.IsNullOrEmpty(testName) ? DefaultTestName : testName; this.ResultPoints = resultPoints; this.GradingOutcome = gradingOutcome; this.Description = description ?? string.Empty; }
private TestResult assertResult(GraderResult result, string?exerciseName, string testName, GradingOutcomes expectedTestOutcome = GradingOutcomes.Graded) { if (result == null) { throw new ArgumentNullException(); } Assert.IsTrue(result.HasResult, "result is empty"); ExerciseResult exerciseResult; if (string.IsNullOrEmpty(exerciseName)) { exerciseResult = result.Exercises.FirstOrDefault(); } else { exerciseResult = result.Exercises.FirstOrDefault(er => er.ExerciseName == exerciseName); } Assert.IsNotNull(exerciseResult, "cannot find exercise"); var testResult = exerciseResult.TestsResults.FirstOrDefault(tr => tr.TestName == testName); Assert.IsNotNull(testResult, "cannot find test"); Assert.AreEqual(expectedTestOutcome, testResult.GradingOutcome); return(testResult); }