/// <summary> /// Creates a new test run and places it into pending status. /// </summary> /// <param name="workingDirectory">The current working directory for the build agent.</param> /// <returns>The identifier of the test run within the database.</returns> public Int64 CreateTestRun(String workingDirectory) { using (var testRunContext = new TestRunContext()) { var run = new TestRun() { Status = TestRunStatus.Pending, WorkingDirectory = workingDirectory }; testRunContext.TestRuns.Add(run); testRunContext.SaveChanges(); return run.ID; } }
/// <summary> /// Updates the status of the specified test run. /// </summary> /// <param name="id">The identifier of the test run within the database.</param> /// <param name="status">The status to set for the specified test run.</param> /// <returns>A <see cref="TestRunStatus"/> value specifying the test run's previous status.</returns> public TestRunStatus UpdateTestRunStatus(Int64 id, TestRunStatus status) { using (var testRunContext = new TestRunContext()) { var run = testRunContext.TestRuns.Where(x => x.ID == id).Single(); var previousStatus = run.Status; run.Status = status; testRunContext.SaveChanges(); return previousStatus; } }