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

            activityOperatorResDesp.ActivityKey = DictionaryHelper.GetValue(dictionary, "ActivityKey", string.Empty);

            return(activityOperatorResDesp);
        }
        public override IDictionary <string, object> Serialize(object obj, System.Web.Script.Serialization.JavaScriptSerializer serializer)
        {
            WfActivityOperatorResourceDescriptor activityOperatorResDesp = (WfActivityOperatorResourceDescriptor)obj;
            IDictionary <string, object>         dictionary = base.Serialize(obj, serializer);

            dictionary.Add("ActivityKey", activityOperatorResDesp.ActivityKey);

            return(dictionary);
        }
		public void WfActivityOperatorResourceDescriptorConverterTest()
		{
			WfConverterHelper.RegisterConverters();

			WfActivityOperatorResourceDescriptor actOperatorResDesp = new WfActivityOperatorResourceDescriptor();
			actOperatorResDesp.ActivityKey = "asdfasdf";
			string result = JSONSerializerExecute.Serialize(actOperatorResDesp);
			Console.WriteLine(result);

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

			string reSerialized = JSONSerializerExecute.Serialize(deserializedDesp);

			Assert.AreEqual(result, reSerialized);

			ResourceConverterTest(actOperatorResDesp);

		}
        public void ActivityOperatorResourceTest()
        {
            IWfProcess process = WfProcessTestCommon.StartupProcessWithAssignee();

            IWfActivityDescriptor nextActivityDesp = process.CurrentActivity.Descriptor.ToTransitions[0].ToActivity;
            WfTransferParams tp = ProcessTestHelper.GetInstanceOfWfTransferParams(nextActivityDesp, OguObject.approver1);
            IUser requestor = (IUser)OguObjectSettings.GetConfig().Objects["requestor"].Object;
            tp.Operator = requestor;

            process.MoveTo(tp);

            WfActivityOperatorResourceDescriptor resource = new WfActivityOperatorResourceDescriptor();
            resource.ActivityKey = process.InitialActivity.Descriptor.Key;
            process.CurrentActivity.Descriptor.Resources.Add(resource);
            OguDataCollection<IUser> users = process.CurrentActivity.Descriptor.Resources.ToUsers();

            Assert.IsTrue(users.Count > 0);
            Assert.AreEqual(requestor.ID, users[0].ID, "验证资源中的人员是否是之前活动的操作人");

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

            users = process.CurrentActivity.Descriptor.Resources.ToUsers();

            Assert.IsTrue(users.Count > 0, "重新加载后资源中应该有人");
            Assert.AreEqual(requestor.ID, users[0].ID, "重新加载后验证资源中的人员是否是之前活动的操作人");
        }