/// <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"; } }