public void ForDirectory(int testStep, string path) { var testStepReportDirectory = new TestStepReportDirectory { TestStepId = testStep, Path = path, }; try { m_Context.Add(testStepReportDirectory); m_Context.StoreChanges(); } catch (Exception e) { m_Diagnostics.Log( LevelToLog.Error, WebApiConstants.LogPrefix, string.Format( CultureInfo.InvariantCulture, "Registering the test step report files failed with error: {0}", e)); throw; } }
private TestStepReportDirectory Patch(TestStepReportDirectory testStepReportDirectory) { var result = StoredTestStepReportDirectories.Find(testStepReportDirectory.Id) ?? StoredTestStepReportDirectories.Add(testStepReportDirectory); if (!result.IsPatched && !result.IsPatching) { result.IsPatching = true; try { var selectedTestStep = TestStep(result.fk_TestStepId); result.TestStep = selectedTestStep; result.IsPatched = true; } finally { result.IsPatching = false; } } return result; }
/// <summary> /// Updates the given report directory. /// </summary> /// <param name="reportDirectory">The report directory that should be updated.</param> public void Update(TestStepReportDirectory reportDirectory) { VerifySchemaVersion(); var storedReportDirectory = TestStepReportDirectory(reportDirectory.Id); if (storedReportDirectory != null) { if (!ReferenceEquals(storedReportDirectory, reportDirectory)) { storedReportDirectory.Path = reportDirectory.Path; if (storedReportDirectory.fk_TestStepId != reportDirectory.fk_TestStepId) { storedReportDirectory.fk_TestStepId = reportDirectory.fk_TestStepId; storedReportDirectory.TestStep = null; Patch(storedReportDirectory); } } var entry = Entry(storedReportDirectory); entry.State = EntityState.Modified; } }
/// <summary> /// Adds a new test step report directory. /// </summary> /// <param name="reportDirectory">The new report directory.</param> public void Add(TestStepReportDirectory reportDirectory) { VerifySchemaVersion(); var result = StoredTestStepReportDirectories.Add(reportDirectory); Patch(result); }