예제 #1
0
        public void WfActivitySerilizeConverterTest()
        {
            WfConverterHelper.RegisterConverters();

            WfActivityDescriptor normalAct = new WfActivityDescriptor("NormalActivity", WfActivityType.NormalActivity);

            normalAct.Name     = "Normal";
            normalAct.CodeName = "Normal Activity";

            WfServiceOperationDefinition enterSvcDef = new WfServiceInvokerFactory().SvcOpDef;

            enterSvcDef.AddressDef.RequestMethod = WfServiceRequestMethod.Get;
            enterSvcDef.OperationName            = "StringTypeService";
            enterSvcDef.RtnXmlStoreParamName     = "EnterServiceRtnXml";

            enterSvcDef.Params.Add(new WfServiceOperationParameter()
            {
                Name  = "input",
                Type  = WfSvcOperationParameterType.String,
                Value = "this is a get action!"
            });

            normalAct.EnterEventExecuteServices.Add(enterSvcDef);

            string result = JSONSerializerExecute.Serialize(normalAct);

            Console.WriteLine(result);

            WfActivityDescriptor deserializedActDesp = JSONSerializerExecute.Deserialize <WfActivityDescriptor>(result);

            string reSerialized = JSONSerializerExecute.Serialize(deserializedActDesp);

            Assert.AreEqual(result, reSerialized);
        }
예제 #2
0
        public void EnterActivityTest()
        {
            WfServiceOperationDefinition enterSvcDef = new WfServiceInvokerFactory().SvcOpDef;
            WfServiceOperationDefinition leaveSvcDef = new WfServiceInvokerFactory().SvcOpDef;

            enterSvcDef.AddressDef.RequestMethod = WfServiceRequestMethod.Get;
            enterSvcDef.OperationName            = "SayHelloWorld";
            enterSvcDef.RtnXmlStoreParamName     = "EnterServiceRtnXml";

            leaveSvcDef.AddressDef.RequestMethod = WfServiceRequestMethod.Get;
            leaveSvcDef.OperationName            = "Add";
            leaveSvcDef.RtnXmlStoreParamName     = "LeaveServiceRtnXml";
            leaveSvcDef.Params.Add(new WfServiceOperationParameter()
            {
                Name  = "a",
                Type  = WfSvcOperationParameterType.Int,
                Value = 50
            });
            leaveSvcDef.Params.Add(new WfServiceOperationParameter()
            {
                Name  = "b",
                Type  = WfSvcOperationParameterType.Int,
                Value = 5
            });

            IWfProcess process = WfProcessTestCommon.StartupProcessWithServiceDefinition(enterSvcDef, leaveSvcDef);

            Console.WriteLine("进入起始活动点");
            Console.WriteLine(process.ApplicationRuntimeParameters[enterSvcDef.RtnXmlStoreParamName]);
            Console.WriteLine(process.ApplicationRuntimeParameters[leaveSvcDef.RtnXmlStoreParamName]);

            IWfActivityDescriptor nextActivityDesp = process.CurrentActivity.Descriptor.ToTransitions[0].ToActivity;
            WfTransferParams      tp = ProcessTestHelper.GetInstanceOfWfTransferParams(nextActivityDesp, OguObject.approver2);

            process.MoveTo(tp);

            Console.WriteLine("离开起始活动点");
            Console.WriteLine(process.ApplicationRuntimeParameters[enterSvcDef.RtnXmlStoreParamName]);
            Console.WriteLine(process.ApplicationRuntimeParameters[leaveSvcDef.RtnXmlStoreParamName]);
            WfRuntime.PersistWorkflows();
            process = WfRuntime.GetProcessByProcessID(process.ID);
        }
		public void WfActivitySerilizeConverterTest()
		{
			WfConverterHelper.RegisterConverters();

			WfActivityDescriptor normalAct = new WfActivityDescriptor("NormalActivity", WfActivityType.NormalActivity);
			normalAct.Name = "Normal";
			normalAct.CodeName = "Normal Activity";

			WfServiceOperationDefinition enterSvcDef = new WfServiceInvokerFactory().SvcOpDef;
			enterSvcDef.AddressDef.RequestMethod = WfServiceRequestMethod.Get;
			enterSvcDef.OperationName = "StringTypeService";
			enterSvcDef.RtnXmlStoreParamName = "EnterServiceRtnXml";

			enterSvcDef.Params.Add(new WfServiceOperationParameter()
			{
				Name = "input",
				Type = WfSvcOperationParameterType.String,
				Value = "this is a get action!"
			});

			normalAct.EnterEventExecuteServices.Add(enterSvcDef);

			string result = JSONSerializerExecute.Serialize(normalAct);

			Console.WriteLine(result);

			WfActivityDescriptor deserializedActDesp = JSONSerializerExecute.Deserialize<WfActivityDescriptor>(result);

			string reSerialized = JSONSerializerExecute.Serialize(deserializedActDesp);

			Assert.AreEqual(result, reSerialized);
		}