Esempio n. 1
0
/// <summary>
/// Replaces parameters with their runtime value
/// </summary>
/// <param name="parametername"></param>
/// <param name="TestId"></param>
/// <returns></returns>
        public static string AutoBuildTestParameters(string parametername, int TestId)
        {
            string ProcessInstanceId = "0";
            string ProcessName       = string.Empty;

            string paramName = parametername.ToLower();


            string result = string.Empty;

            switch (paramName)
            {
            case "serialnumber":
            {
                K2WorkflowMap.WorkflowInstanceFramework workflow = new K2WorkflowMap.WorkflowInstanceFramework();
                ProcessInstanceId = GetTestDetails(TestId)[0].ProcessInstanceId.ToString();
                ProcessName       = GetTestDetails(TestId)[0].WorkflowName;
                var task = workflow.GetTask(ProcessInstanceId, ProcessName);
                result = task[0].SerialNumber;

                break;
            }

            case "sn":
            {
                K2WorkflowMap.WorkflowInstanceFramework workflow = new K2WorkflowMap.WorkflowInstanceFramework();
                ProcessInstanceId = GetTestDetails(TestId)[0].ProcessInstanceId.ToString();
                ProcessName       = GetTestDetails(TestId)[0].WorkflowName;
                var task = workflow.GetTask(ProcessInstanceId, ProcessName);
                result = task[0].SerialNumber;

                break;
            }

            case "processinstanceid":
            {
                result = GetTestDetails(TestId)[0].ProcessInstanceId.ToString();
                break;
            }

            case "activities":
            {
                result = GetTestDetails(TestId)[0].Route.ToString();
                break;
            }

            case "destinationuser":
            {
                break;
            }

            default:
            {
                result = parametername;
                break;
            }
            }

            return(result);
        }
        public void WorkList_RetrieveTaskList_Success()
        {
            string Actual = string.Empty;

            int.TryParse(Results.GetResult(TestType.ProcessInstance), out this.proceessInstance);

            var task = workflow.GetTask(this.proceessInstance.ToString(), this.ProcessName);

            this.SerialNumber = task[0].SerialNumber;
            Results.SaveResult(TestType.SerialNumber, this.SerialNumber);
            this.DestinationUser = task[0].Destination;
            Results.SaveResult(TestType.Destination, this.DestinationUser);
            Actual = task[0].ActivityName;
            Results.SaveResult(TestType.TaskActivity, Actual);


            Assert.AreEqual(this.TaskActivity, Actual);
        }