示例#1
0
        public void WfGroupResourceDescriptorConverterTest()
        {
            WfConverterHelper.RegisterConverters();

            IUser user = (IUser)OguObjectSettings.GetConfig().Objects["requestor"].Object;

            OguObjectCollection <IGroup> groupColl = user.MemberOf;

            foreach (var group in groupColl)
            {
                WfGroupResourceDescriptor groupDesp = new WfGroupResourceDescriptor(group);

                string result = JSONSerializerExecute.Serialize(groupDesp);

                Console.WriteLine(result);

                WfGroupResourceDescriptor deserializedGroupDesp = JSONSerializerExecute.Deserialize <WfGroupResourceDescriptor>(result);

                string reSerialized = JSONSerializerExecute.Serialize(deserializedGroupDesp);

                Assert.AreEqual(result, reSerialized);

                ResourceConverterTest(groupDesp);
            }
        }
 public override void ClientToServer(WfClientResourceDescriptor client, ref WfResourceDescriptor server)
 {
     if (server == null)
     {
         server = new WfGroupResourceDescriptor((IGroup)((WfClientGroupResourceDescriptor)client).Group.ToOguObject());
     }
     else
     {
         ((WfGroupResourceDescriptor)server).Group = (IGroup)((WfClientGroupResourceDescriptor)client).Group.ToOguObject();
     }
 }