/// <summary>Save the test results to TestResults table</summary>
        /// <param name="result">TestResult</param>
        public void Accept(RuleEngine.TestResult result)
        {
            if (result == null)
            {
                return;
            }

            TestResult testResult = new TestResult();
            testResult.ValidationJobID = this.jobId;
            testResult.RuleName = result.RuleName;
            testResult.Description = result.Description;

            // TODO: need ErrorMessage property on CheckResult
            testResult.ErrorMessage = result.ErrorDetail != null ? result.ErrorDetail : string.Empty;
            testResult.HelpUri = result.HelpLink;

            testResult.SpecificationUri = "version:" + result.Version + ";";

            // TODO: need spec back in HTML form.
            if (result.SpecificationSection != null && result.V4SpecificationSection != null)
            {
                testResult.SpecificationUri += "V4SpecificationSection:" + result.V4SpecificationSection + "&SpecificationSection:" + result.SpecificationSection;
            }
            else if (result.SpecificationSection != null && result.V4SpecificationSection == null)
            {
                testResult.SpecificationUri += result.SpecificationSection;
            }
            else
            {
                testResult.SpecificationUri += result.V4SpecificationSection;
            }

            if (result.V4Specification != null)
            {
                testResult.SpecificationUri += ";V4Specification:" + result.V4Specification;
            }

            testResult.Classification = result.Classification;
            testResult.ODataLevel = result.Category;
            testResult.LineNumberInError = result.LineNumberInError.ToString(CultureInfo.CurrentCulture);

            this.resultsToSave.Add(testResult);

            if (result.Details != null)
            {
                foreach (ExtensionRuleResultDetail detail in result.Details)
                {
                    this.details.Add(detail.Clone());
                }
            }

            // save results to DB in batches of 5
            if (this.resultsToSave.Count >= ResultBatchSize)
            {
                using (var ctx = SuiteEntitiesUtility.GetODataValidationSuiteEntities())
                {
                    this.ProcessResultsBatchByJobCompleted(ctx, false);
                }
            }
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the TestResults EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToTestResults(TestResult testResult)
 {
     base.AddObject("TestResults", testResult);
 }
 /// <summary>
 /// Create a new TestResult object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 /// <param name="ruleName">Initial value of the RuleName property.</param>
 /// <param name="description">Initial value of the Description property.</param>
 /// <param name="classification">Initial value of the Classification property.</param>
 /// <param name="oDataLevel">Initial value of the ODataLevel property.</param>
 /// <param name="validationJobID">Initial value of the ValidationJobID property.</param>
 /// <param name="errorMessage">Initial value of the ErrorMessage property.</param>
 public static TestResult CreateTestResult(global::System.Int32 id, global::System.String ruleName, global::System.String description, global::System.String classification, global::System.String oDataLevel, global::System.Guid validationJobID, global::System.String errorMessage)
 {
     TestResult testResult = new TestResult();
     testResult.ID = id;
     testResult.RuleName = ruleName;
     testResult.Description = description;
     testResult.Classification = classification;
     testResult.ODataLevel = oDataLevel;
     testResult.ValidationJobID = validationJobID;
     testResult.ErrorMessage = errorMessage;
     return testResult;
 }