internal static WfClientNextStepCollection PrepareNextSteps()
        {
            WfClientNextStepCollection result = new WfClientNextStepCollection();

            WfClientNextStep step1 = new WfClientNextStep();

            step1.TransitionKey = "L1";
            step1.TransitionName = "线1";
            step1.TransitionDescription = "线描述1";

            step1.ActivityKey = "N1";
            step1.ActivityName = "活动1";
            step1.ActivityDescription = "活动描述1";

            result.Add(step1);

            WfClientNextStep step2 = new WfClientNextStep();

            step2.TransitionKey = "L2";
            step2.TransitionName = "线2";
            step2.TransitionDescription = "线描述2";

            step2.ActivityKey = "N2";
            step2.ActivityName = "活动2";
            step2.ActivityDescription = "活动描述2";

            result.Add(step2);

            result.SelectedKey = "L2";

            return result;
        }
        internal static void AreSame(WfClientNextStepCollection expected, WfClientNextStepCollection actual)
        {
            Assert.AreEqual(expected.Count, actual.Count);
            Assert.AreEqual(expected.SelectedKey, actual.SelectedKey);

            for (int i = 0; i < expected.Count; i++)
                AreSame(expected[i], actual[i]);
        }
        public void WfClientNextStepToXElementTest()
        {
            WfClientNextStepCollection expected = PrepareNextSteps();

            XElement root = new XElement("NextSteps");

            expected.ToXElement(root);

            Console.WriteLine(root.ToString());

            WfClientNextStepCollection actual = new WfClientNextStepCollection(root);

            AreSame(expected, actual);

            Assert.AreEqual(expected.SelectedKey, actual.GetSelectedStep().TransitionKey);
        }
        private static string PrepareAbortProcessNextStepsString()
        {
            WfClientNextStepCollection nextSteps = new WfClientNextStepCollection();

            WfClientNextStep nextStep = new WfClientNextStep();

            nextStep.TransitionKey = "AbortProcess";
            nextStep.TransitionName = "作废";
            nextStep.TransitionDescription = "作废";

            nextStep.ActivityKey = "AbortProcess";
            nextStep.ActivityName = "作废";
            nextStep.ActivityDescription = "作废";

            nextSteps.Add(nextStep);

            nextSteps.SelectedKey = "AbortProcess";

            XElement nextStepsRoot = new XElement("NextSteps");

            nextSteps.ToXElement(nextStepsRoot);

            return nextStepsRoot.ToString();
        }
        private static string PrepareNextStepsSelectorsString(IEnumerable<IWfTransitionDescriptor> transitions, WfTransferParamsBase transferParams)
        {
            WfClientNextStepCollection nextSteps = new WfClientNextStepCollection();

            foreach (IWfTransitionDescriptor transition in transitions)
            {
                WfClientNextStep nextStep = new WfClientNextStep();

                nextStep.TransitionKey = transition.Key;
                nextStep.TransitionName = transition.Name;
                nextStep.TransitionDescription = transition.Description;

                nextStep.ActivityKey = transition.ToActivity.Key;
                nextStep.ActivityName = transition.ToActivity.Name;
                nextStep.ActivityDescription = transition.ToActivity.Description;

                nextSteps.Add(nextStep);
            }

            if (transferParams != null && transferParams.FromTransitionDescriptor != null)
                nextSteps.SelectedKey = transferParams.FromTransitionDescriptor.Key;

            XElement nextStepsRoot = new XElement("NextSteps");

            nextSteps.ToXElement(nextStepsRoot);

            return nextStepsRoot.ToString();
        }