/// <summary>
		/// Returns a mock code runner service.
		/// </summary>
		private Mock<ICodeRunnerService> GetMockCodeRunnerService(
			ClassJobResult jobResult = null)
		{
			jobResult = jobResult ?? GetSuccessfulClassJobResult();

			var codeRunnerService = new Mock<ICodeRunnerService>();

			codeRunnerService
				.Setup
				(
					crs => crs.ExecuteClassJobAsync
					(
						It.IsAny<ClassJob>()
					)
				).ReturnsAsync(jobResult);

			return codeRunnerService;
		}
		/// <summary>
		/// Returns a code runner service that responds with the 
		/// given result, when called with the given job.
		/// </summary>
		public ICodeRunnerService GetCodeRunnerService(
			ClassJobResult expectedClassJobResult,
			Expression<Func<ClassJob, bool>> expectedClassJob = null)
		{
			if (expectedClassJob == null)
			{
				expectedClassJob = job => true;
			}

			var codeRunnerService = new Mock<ICodeRunnerService>();

			codeRunnerService
				.Setup(crs => crs.ExecuteClassJobAsync(It.Is(expectedClassJob)))
				.ReturnsAsync(expectedClassJobResult);

			return codeRunnerService.Object;
		}
		public async Task GenerateQuestionAsync_GeneratorCompilationError_ReturnsError()
		{
			var question = GetGeneratedQuestionTemplate();
			var classJobResult = new ClassJobResult()
			{
				ClassCompilationResult = new CompilationResult()
				{
					Success = false,
					Errors = Collections.CreateList
					(
						new CompileError() { FullError = "Error1" },
						new CompileError() { FullError = "Error2" }
					)
				}
			};

			var questionGenerator = GetQuestionGenerator
			(
				question,
				GetMockCodeRunnerService(classJobResult).Object
			);

			var result = await questionGenerator.GenerateQuestionAsync
			(
				question,
				1 /*seed*/
			);

			Assert.NotNull(result.Error);
			Assert.True(result.Error.Contains("Error1"));
			Assert.True(result.Error.Contains("Error2"));
			Assert.Null(result.SerializedQuestion);
		}