use of de.tum.in.www1.artemis.domain.enumeration.QuizMode in project ArTEMiS by ls1intum.
the class ResultServiceIntegrationTest method testGetResultsForQuizExercise.
@ParameterizedTest(name = "{displayName} [{index}] {argumentsWithNames}")
@WithMockUser(username = "instructor1", roles = "INSTRUCTOR")
@EnumSource(QuizMode.class)
public void testGetResultsForQuizExercise(QuizMode quizMode) throws Exception {
var now = ZonedDateTime.now();
QuizExercise quizExercise = database.createQuiz(course, now.minusHours(5), now.minusMinutes(2), quizMode);
quizExerciseRepository.save(quizExercise);
for (int i = 1; i <= 10; i++) {
QuizSubmission quizSubmission = new QuizSubmission();
quizSubmission.setScoreInPoints(2.0);
quizSubmission.submitted(true);
quizSubmission.submissionDate(now.minusHours(3));
database.addSubmission(quizExercise, quizSubmission, "student" + i);
if (i % 3 == 0) {
database.addResultToSubmission(quizSubmission, AssessmentType.AUTOMATIC, null, 10D, true);
} else if (i % 4 == 0) {
database.addResultToSubmission(quizSubmission, AssessmentType.AUTOMATIC, null, 20D, true);
}
}
List<Result> results = request.getList("/api/exercises/" + quizExercise.getId() + "/results", HttpStatus.OK, Result.class);
assertThat(results).hasSize(5);
// TODO: check additional values
}
use of de.tum.in.www1.artemis.domain.enumeration.QuizMode in project Artemis by ls1intum.
the class ResultServiceIntegrationTest method testGetResultsForQuizExercise.
@ParameterizedTest(name = "{displayName} [{index}] {argumentsWithNames}")
@WithMockUser(username = "instructor1", roles = "INSTRUCTOR")
@EnumSource(QuizMode.class)
public void testGetResultsForQuizExercise(QuizMode quizMode) throws Exception {
var now = ZonedDateTime.now();
QuizExercise quizExercise = database.createQuiz(course, now.minusHours(5), now.minusMinutes(2), quizMode);
quizExerciseRepository.save(quizExercise);
for (int i = 1; i <= 10; i++) {
QuizSubmission quizSubmission = new QuizSubmission();
quizSubmission.setScoreInPoints(2.0);
quizSubmission.submitted(true);
quizSubmission.submissionDate(now.minusHours(3));
database.addSubmission(quizExercise, quizSubmission, "student" + i);
if (i % 3 == 0) {
database.addResultToSubmission(quizSubmission, AssessmentType.AUTOMATIC, null, 10D, true);
} else if (i % 4 == 0) {
database.addResultToSubmission(quizSubmission, AssessmentType.AUTOMATIC, null, 20D, true);
}
}
List<Result> results = request.getList("/api/exercises/" + quizExercise.getId() + "/results", HttpStatus.OK, Result.class);
assertThat(results).hasSize(5);
// TODO: check additional values
}
Aggregations