/// <summary>
 /// converts test-management test-actions into a connector test-actions
 /// </summary>
 /// <param name="testCase">test-case to convert steps from</param>
 /// <returns>test-steps collection</returns>
 public static IEnumerable <RhinoTestStep> GetConnectorSteps(this TestRailCase testCase)
 {
     return(testCase.CustomStepsSeparated.Select(i => new RhinoTestStep
     {
         Action = i.Content,
         Expected = i.Expected
     }));
 }
 // UTILITIES
 private static DataTable DoGetLocalDataSource(this TestRailCase testCase)
 {
     // exit conditions
     if (string.IsNullOrEmpty(testCase.CustomPreconds))
     {
         return(new DataTable());
     }
     return(new DataTable().FromMarkDown(testCase.CustomPreconds, default));
 }
        private RhinoTestCase ToConnectorTestCase(TestRailCase testRailCase)
        {
            // get priority
            var priority = prioritiesClient
                           .GetPriorities()
                           .FirstOrDefault(i => i.Id.Equals(testRailCase.PriorityId));

            // set
            var testCase = testRailCase.ToConnectorTestCase();

            testCase.Priority = $"{priority.Priority} - {priority.Name}";
            testCase.Context["projectKey"] = string.IsNullOrEmpty($"{jiraClient?.Authentication?.Project}")
                ? "-1"
                : jiraClient.Authentication.Project;

            // get
            return(testCase);
        }
        /// <summary>
        /// converts test-management test-case interface into a connector test-case
        /// ready for automation
        /// </summary>
        /// <param name="testCase">test-cases to convert</param>
        /// <returns>connector test-case</returns>
        public static RhinoTestCase ToConnectorTestCase(this TestRailCase testCase)
        {
            var connectorTesetCase = new RhinoTestCase
            {
                Actual       = false,
                Context      = testCase.Context,
                Inconclusive = false,
                Key          = $"{testCase.Id}",
                DataSource   = DoGetLocalDataSource(testCase).ToDictionary(),
                Severity     = $"{testCase.CustomSeverity}",
                Tolerance    = testCase.CustomTolerance,
                Scenario     = testCase.Title,
                Steps        = testCase.GetConnectorSteps(),
                TestSuites   = new[] { $"{testCase?.SuiteId}" }
            };

            connectorTesetCase.Severity  = string.IsNullOrEmpty(connectorTesetCase.Severity) ? "Unavailable" : connectorTesetCase.Severity;
            connectorTesetCase.Iteration = 1;
            return(connectorTesetCase);
        }
 /// <summary>
 /// gets this test-case local data-provider
 /// </summary>
 /// <param name="testCase">this test-case instance</param>
 /// <returns>local data-provider</returns>
 public static DataTable GetLocalDataSource(this TestRailCase testCase)
 {
     return(DoGetLocalDataSource(testCase));
 }