/// <summary> /// Initializes a new instance of the <see cref="TestCase" /> class. /// </summary> /// <param name="testCaseCore">The test case core object.</param> /// <param name="testSuiteBaseCore">The test suite base core object.</param> /// <param name="initializeStatus">if set to <c>true</c> [initialize status].</param> public TestCase(ITestCase testCaseCore, ITestSuiteBase testSuiteBaseCore, ITestPlan testPlan, bool initializeStatus = true) { this.ITestCase = testCaseCore; this.ITestSuiteBase = testSuiteBaseCore; this.TestCaseId = testCaseCore.Id; this.Title = testCaseCore.Title; this.Area = testCaseCore.Area; this.Priority = (Priority)testCaseCore.Priority; if (testCaseCore.OwnerTeamFoundationId != default(Guid) && !string.IsNullOrEmpty(testCaseCore.OwnerName)) { this.TeamFoundationIdentityName = new TeamFoundationIdentityName(testCaseCore.OwnerTeamFoundationId, testCaseCore.OwnerName); } this.OwnerDisplayName = testCaseCore.OwnerName; this.TeamFoundationId = testCaseCore.OwnerTeamFoundationId; this.TestSuiteId = (testSuiteBaseCore == null) ? null : (int?)testSuiteBaseCore.Id; base.isInitialized = true; this.Id = testCaseCore.Id; this.DateCreated = testCaseCore.DateCreated; this.DateModified = testCaseCore.DateModified; this.CreatedBy = testCaseCore.WorkItem.CreatedBy; if (testSuiteBaseCore != null) { this.TestSuiteTitle = testSuiteBaseCore.Title; } if (initializeStatus) { string mostRecentResult = TestCaseManager.GetMostRecentTestCaseResult(testPlan, this.Id); this.LastExecutionOutcome = TestCaseManager.GetTestCaseExecutionType(mostRecentResult); } if (ExecutionContext.TestCaseRuns.ContainsKey(this.Id)) { this.IsRunning = "R"; } }
/// <summary> /// Gets all full test cases for observable test cases. /// </summary> /// <param name="testPlan">The test plan.</param> /// <param name="selectedTestCases">The selected test cases.</param> /// <returns> /// list of full test cases /// </returns> private List <TestCaseFull> GetAllFullTestCasesForObservableTestCases(List <TestCase> selectedTestCases) { List <TestCaseFull> fullTestCases = new List <TestCaseFull>(); foreach (TestCase currentTestCase in selectedTestCases) { string mostRecentResult = TestCaseManager.GetMostRecentTestCaseResult(ExecutionContext.Preferences.TestPlan, currentTestCase.Id); string executionComment = TestCaseManager.GetMostRecentExecutionComment(ExecutionContext.Preferences.TestPlan, currentTestCase.Id); List <TestStep> currentTestSteps = TestStepManager.GetTestStepsFromTestActions(ExecutionContext.TestManagementTeamProject, currentTestCase.ITestCase.Actions); fullTestCases.Add(new TestCaseFull(currentTestCase, currentTestSteps, mostRecentResult, executionComment)); } return(fullTestCases); }