コード例 #1
0
        public static TestCaseProxy TestCaseModelToProxy(TestCase model)
        {
            TestCaseProxy proxyObject = new TestCaseProxy();
            proxyObject.Id = model.ID;
            proxyObject.Title = model.Title;
            proxyObject.Priority = EnumUtil.ParseEnum<Priority>(model.Priority);
            proxyObject.Severity = EnumUtil.ParseEnum<Severity>(model.Severity);
            proxyObject.IsAutomated = model.IsAutomated;
            proxyObject.CreatedBy = model.CreatedBy;
            proxyObject.UpdatedBy = model.UpdatedBy;
            proxyObject.AreaID = model.AreaID;

            foreach (var item in new TestManager().GetStepDefinitionsById(model.ID))
            {
                StepDefinitionProxy proxy = new StepDefinitionProxy();
                proxy.Step = item.Step;
                proxy.ExpectedResult = item.ExpectedResult;
                proxy.ID = item.ID;
                proxy.TestCaseID = item.TestCaseID;

                proxyObject.StepDefinitionList.Add(proxy);
            }

            return proxyObject;
        }
コード例 #2
0
        private NewIssue PopulateIssue(TestCase testCase)
        {
            NewIssue issue = new NewIssue(string.Format("[Bug] {0}", testCase.Title));
            StringBuilder bodyBuilder = bodyBuilder = new StringBuilder();
            bodyBuilder.AppendLine("## Steps to reproduce");
            bodyBuilder.AppendLine();

            int counter = 1;
            foreach (var stepDefinition in new TestManager().GetStepDefinitionsById(testCase.ID))
            {
                if (string.IsNullOrWhiteSpace(stepDefinition.ExpectedResult) == false)
                    bodyBuilder.AppendLine(string.Format("{0}. {1} - *Expected result:* {2}", counter, stepDefinition.Step, stepDefinition.ExpectedResult));
                else
                    bodyBuilder.AppendLine(string.Format("{0}. {1}", counter, stepDefinition.Step));

                counter++;
            }

            bodyBuilder.AppendLine();
            bodyBuilder.AppendLine("## Additinal info");
            bodyBuilder.AppendLine();
            bodyBuilder.AppendLine(string.Format("**Test case ID :** {0}", testCase.ID));
            bodyBuilder.AppendLine(string.Format("**Severity :** {0}", testCase.Severity));
            bodyBuilder.AppendLine(string.Format("**Priority :** {0}", testCase.Priority));
            bodyBuilder.AppendLine(string.Format("**Created by :** {0}", testCase.CreatedBy));
            bodyBuilder.AppendLine(string.Format("**Is Automated :** {0}", testCase.IsAutomated));

            issue.Body = bodyBuilder.ToString();

            return issue;
        }
コード例 #3
0
        public static TestCase TestCaseProxyToModel(TestCaseProxy proxy)
        {
            TestCase testCase = new TestCase();
            testCase.ID = proxy.Id;
            testCase.Title = proxy.Title;
            testCase.Priority = proxy.Priority.ToString();
            testCase.Severity = proxy.Severity.ToString();
            testCase.IsAutomated = proxy.IsAutomated;
            testCase.CreatedBy = proxy.CreatedBy;
            testCase.UpdatedBy = proxy.UpdatedBy;
            testCase.AreaID = proxy.AreaID;
            testCase.StepDefinitions = StepDefinitionModelToProxy(proxy.StepDefinitionList);

            return testCase;
        }