internal async Task ThrowIfCannotAnswer_CorrectTestSessionState_Success( Guid studentTestSessionId, [Frozen] Mock <IUnitOfWork> unitOfWorkMock, StudentQuestionValidationService studentQuestionValidationService) { // Arrange unitOfWorkMock.Setup(e => e.Any(It.IsAny <StudentTestSessionQueryParameters>())).ReturnsAsync(true); // Act Func <Task> action = () => studentQuestionValidationService.ThrowIfCannotAnswer(studentTestSessionId); // Assert await action.Should().NotThrowAsync <CodedException>(); }
internal async Task ThrowIfCannotAnswer_IncorrectTestSessionState_ThrowsException( Guid studentTestSessionId, [Frozen] Mock <IUnitOfWork> unitOfWorkMock, StudentQuestionValidationService studentQuestionValidationService) { // Arrange unitOfWorkMock.Setup(e => e.Any(It.IsAny <StudentTestSessionQueryParameters>())).ReturnsAsync(false); // Act Func <Task> action = () => studentQuestionValidationService.ThrowIfCannotAnswer(studentTestSessionId); // Assert await action.Should().ThrowWithCode <CodedException>(ErrorCode.StudentTestSessionEnded); }