/// <summary> /// The method returns all test cases as sorted list. /// </summary> /// <param name="sort">Sort to use for the returned test cases.</param> /// <returns>Sorted </returns> public IList <ITfsTestCaseDetail> GetTestCases(TestCaseSortType sort) { var testCases = new List <ITfsTestCaseDetail>(); testCases.AddRange(TestCases); if (sort == TestCaseSortType.None) { return(testCases); } testCases.Sort((a, b) => { switch (sort) { case TestCaseSortType.AreaPath: return(string.Compare(a.AreaPath, b.AreaPath, CultureInfo.CurrentCulture, CompareOptions.OrdinalIgnoreCase)); case TestCaseSortType.IterationPath: return(string.Compare(a.IterationPath, b.IterationPath, CultureInfo.CurrentCulture, CompareOptions.OrdinalIgnoreCase)); } return(a.WorkItemId - b.WorkItemId); }); return(testCases); }
/// <summary> /// Initializes a new instance of the <see cref="TestSpecificationReportModel"/> class for the console extension /// </summary> /// <param name="syncServiceDocumentModel">The <see cref="ISyncServiceModel"/> to obtain document settings.</param> /// <param name="testAdapter"><see cref="ITfsTestAdapter"/> to examine test information.</param> /// <param name="sort"></param> /// <param name="testReportingProgressCancellationService">The progess cancellation service used to check at certain points if a cancellation has been triggered and further steps should be skipped.</param> /// <param name="plan">The selected <see cref="ITfsTestPlan"/> used for the report generation.</param> /// <param name="suite">The selected <see cref="ITfsTestSuite"/> used for the report generation.</param> /// <param name="documentStructure">The information if a document structure should be created.</param> /// <param name="skipLevels">The level count to ignore generation.</param> /// <param name="structureType"></param> public TestSpecificationReportModel(ISyncServiceDocumentModel syncServiceDocumentModel, ITfsTestAdapter testAdapter, ITfsTestPlan plan, ITfsTestSuite suite, bool documentStructure, int skipLevels, DocumentStructureType structureType, TestCaseSortType sort, ITestReportingProgressCancellationService testReportingProgressCancellationService) : base(syncServiceDocumentModel, testAdapter, testReportingProgressCancellationService) { SelectedTestPlan = plan; SelectedTestSuite = suite; CreateDocumentStructure = documentStructure; SkipLevels = skipLevels; SelectedDocumentStructureType = structureType; SelectedTestCaseSortType = sort; CreateReportCommand = new ViewCommand(ExecuteCreateReportCommand, CanExecuteCreateReportCommand); WordDocument = syncServiceDocumentModel.WordDocument as Document; }
private void SetTestReportDefaults(ITestSpecReportDefault configuredDefaults) { if (configuredDefaults == null) { return; } //direclty initialized CreateDocumentStructure = configuredDefaults.CreateDocumentStructure; SelectedDocumentStructureType = configuredDefaults.DocumentStructureType; IncludeTestConfigurations = configuredDefaults.IncludeTestConfigurations; SelectedConfigurationPositionType = configuredDefaults.ConfigurationPositionType; SelectedTestCaseSortType = configuredDefaults.TestCaseSortType; SkipLevels = configuredDefaults.SkipLevels; //lazy initilized because value list is evalueated in background thread _defaultTestPlanName = configuredDefaults.SelectTestPlan; _defaultTestSuiteName = configuredDefaults.SelectTestSuite; }
/// <summary> /// The method finds all test cases by the path in given <see cref="PathElement"/> as sorted list. /// </summary> /// <param name="pathElement"><see cref="PathElement"/> determines path of test cases.</param> /// <param name="sort">Sort to use for the returned test cases.</param> /// <returns>Sorted </returns> public IList <ITfsTestCaseDetail> GetTestCases(PathElement pathElement, TestCaseSortType sort) { if (pathElement == null) { return(null); } var testCases = new List <ITfsTestCaseDetail>(); foreach (var testCase in TestCases) { if ((PathType == DocumentStructureType.AreaPath && pathElement.WholePath == testCase.AreaPath) || (PathType == DocumentStructureType.IterationPath && pathElement.WholePath == testCase.IterationPath)) { testCases.Add(testCase); } } if (sort == TestCaseSortType.None) { return(testCases); } testCases.Sort((a, b) => { switch (sort) { case TestCaseSortType.AreaPath: return(string.Compare(a.AreaPath, b.AreaPath, CultureInfo.CurrentCulture, CompareOptions.OrdinalIgnoreCase)); case TestCaseSortType.IterationPath: return(string.Compare(a.IterationPath, b.IterationPath, CultureInfo.CurrentCulture, CompareOptions.OrdinalIgnoreCase)); } return(a.WorkItemId - b.WorkItemId); }); return(testCases); }