public void SetUp()
        {
            _contextMock = new Mock<IDbContext>();

            _compiler = new TestCompiler();
            _runner = new TestRunner();
            _participant = new Participant { Email = "", Id = 12 };
            _controller = new RunController(_contextMock.Object, _compiler, _runner, _participant);
        }
        /// <summary>
        /// Build and runs an assignment and checks the scores for the user submitted code.
        /// </summary>
        /// <param name="runJob">See RunController.</param>
        /// <returns></returns>
        public HttpResponseMessage Post(RunController.RunJob runJob)
        {
            _compiler.CompileFromPlainText(_participant, runJob.Code);
            var runResult = _runner.RunAndCheckInput(_participant);
            var correctOutput = IsCorrectOutput(runResult);
            var timeDifference = TimeDifferenceHelper.GetTimeDifference(_participant.Progress.StartTime);

            var score = ScoreHelper.CreateScore(_participant.Progress.Assignment, _participant, correctOutput, timeDifference);

            _context.Scores.Add(score);
            _context.Progresses.Remove(_participant.Progress);
            _context.SaveChanges();

            return Request.CreateResponse(HttpStatusCode.Created);
        }
 public void SetRunConstructorWithoutGivenParticipantGivesInvalidOperationFromTest()
 {
     _controller = new RunController(_contextMock.Object, _compiler, _runner);
 }