public void ActivityConditionTest() { TestContext.Properties["Amount"] = 2500; //不满足条件 WfRuntime.ProcessContext.EvaluateActivityCondition += new Expression.CalculateUserFunction(ProcessContext_EvaluateTransition); IWfProcess process = WfProcessTestCommon.StartupSimpleProcessDescriptorWithActivityCondition(); Assert.AreEqual(WfActivityStatus.Running, process.InitialActivity.Status); IWfActivityDescriptor nextActivityDesp = process.CurrentActivity.Descriptor.ToTransitions[0].ToActivity; WfTransferParams transferParams = ProcessTestHelper.GetInstanceOfWfTransferParams(nextActivityDesp, OguObject.requestor); process.MoveTo(transferParams); Assert.AreEqual(WfActivityStatus.Completed, process.InitialActivity.Status); Assert.AreEqual(WfActivityStatus.Pending, process.CurrentActivity.Status); IWfActivity activity = WfRuntime.ProcessContext.OriginalActivity; WfRuntime.PersistWorkflows(); TestContext.Properties["Amount"] = 7500; WfPendingActivityInfoCollection pendingActivities = WfPendingActivityInfoAdapter.Instance.Load(builder => builder.AppendItem("ACTIVITY_ID", process.CurrentActivity.ID)); pendingActivities.ForEach(pai => WfRuntime.ProcessPendingActivity(pai)); }