public override object Deserialize(IDictionary <string, object> dictionary, Type type, System.Web.Script.Serialization.JavaScriptSerializer serializer)
        {
            WfActivityAssigneesResourceDescriptor activityAssigneesResDesp = (WfActivityAssigneesResourceDescriptor)base.Deserialize(dictionary, type, serializer);

            activityAssigneesResDesp.ActivityKey = DictionaryHelper.GetValue(dictionary, "ActivityKey", string.Empty);
            return(activityAssigneesResDesp);
        }
        public override IDictionary <string, object> Serialize(object obj, System.Web.Script.Serialization.JavaScriptSerializer serializer)
        {
            WfActivityAssigneesResourceDescriptor activityAssigneesResDesp = (WfActivityAssigneesResourceDescriptor)obj;

            IDictionary <string, object> dictionary = base.Serialize(obj, serializer);

            dictionary.Add("ActivityKey", activityAssigneesResDesp.ActivityKey);
            return(dictionary);
        }
		public void WfActivityAssigneesResourceDescriptorConverterTest()
		{
			WfConverterHelper.RegisterConverters();

			WfActivityAssigneesResourceDescriptor actAssigneesResDesp = new WfActivityAssigneesResourceDescriptor();
			actAssigneesResDesp.ActivityKey = "asfasf";
			string result = JSONSerializerExecute.Serialize(actAssigneesResDesp);
			Console.WriteLine(result);

			WfActivityAssigneesResourceDescriptor deserializedDesp = JSONSerializerExecute.Deserialize<WfActivityAssigneesResourceDescriptor>(result);

			string reSerialized = JSONSerializerExecute.Serialize(deserializedDesp);

			Assert.AreEqual(result, reSerialized);

			ResourceConverterTest(actAssigneesResDesp);
		}
Exemplo n.º 4
0
        private static IWfProcess GetProcessInstanceWithAssigneesResource()
        {
            IWfProcess process = WfProcessTestCommon.StartupProcessWithAssignee();

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

            WfRuntime.PersistWorkflows();
            process = WfRuntime.GetProcessByProcessID(process.ID);

            IWfActivityDescriptor actDesp = process.CurrentActivity.Descriptor.ToTransitions[0].ToActivity;
            WfActivityAssigneesResourceDescriptor actAssResDesp = new WfActivityAssigneesResourceDescriptor();
            actAssResDesp.ActivityKey = actDesp.Key;
            actDesp.Resources.Add(actAssResDesp);

            nextActivityDesp = process.CurrentActivity.Descriptor.ToTransitions[0].ToActivity;
            WfTransferParams tpa = ProcessTestHelper.GetInstanceOfWfTransferParams(nextActivityDesp, OguObject.approver1);
            process.MoveTo(tpa);

            WfRuntime.PersistWorkflows();
            process = WfRuntime.GetProcessByProcessID(process.ID);
            return process;
        }