public void WfProcessDescriptorInfoToClientTest()
        {
            WfProcessDescriptorInfo server = PrepareServerData();

            ClearServerData(server.ProcessKey);

            WfClientProcessDescriptorInfo client = null;

            WfClientProcessDescriptorInfoConverter.Instance.ServerToClient(server, ref client);

            client.AreSame(server);
        }
示例#2
0
        public void ServerToClient(WfProcessDescriptorInfoCollection server, WfClientProcessDescriptorInfoCollection client)
        {
            server.NullCheck("server");
            client.NullCheck("client");

            client.Clear();

            foreach (WfProcessDescriptorInfo processInfo in server)
            {
                WfClientProcessDescriptorInfo clientInfo = null;

                this.ServerToClient(processInfo, ref clientInfo);

                client.Add(clientInfo);
            }
        }
示例#3
0
        public static void AreSame(this WfClientProcessDescriptorInfo expected, WfClientProcessDescriptorInfo actual)
        {
            AssertStringEqual(expected.ProcessKey, actual.ProcessKey);
            AssertStringEqual(expected.ProcessName, actual.ProcessName);
            AssertStringEqual(expected.ApplicationName, actual.ApplicationName);
            AssertStringEqual(expected.ProgramName, actual.ProgramName);

            AssertStringEqual(expected.Data, actual.Data);
            Assert.AreEqual(expected.Enabled, actual.Enabled);

            Assert.AreEqual(expected.CreateTime, actual.CreateTime);
            Assert.AreEqual(expected.ModifyTime, actual.ModifyTime);
            Assert.AreEqual(expected.ImportTime, actual.ImportTime);

            expected.Creator.AreSame(actual.Creator);
            expected.Modifier.AreSame(actual.Modifier);
            expected.ImportUser.AreSame(actual.ImportUser);
        }
示例#4
0
        public static void AreSame(this WfClientProcessDescriptorInfo client, WfProcessDescriptorInfo server)
        {
            AssertStringEqual(client.ProcessKey, server.ProcessKey);
            AssertStringEqual(client.ProcessName, server.ProcessName);
            AssertStringEqual(client.ApplicationName, server.ApplicationName);
            AssertStringEqual(client.ProgramName, server.ProgramName);

            AssertStringEqual(client.Data, server.Data);
            Assert.AreEqual(client.Enabled, server.Enabled);

            Assert.AreEqual(client.CreateTime, server.CreateTime);
            Assert.AreEqual(client.ModifyTime, server.ModifyTime);
            Assert.AreEqual(client.ImportTime, server.ImportTime);

            client.Creator.AreSame(server.Creator);
            client.Modifier.AreSame(server.Modifier);
            client.ImportUser.AreSame(server.ImportUser);
        }
        public void WfProcessDescriptorInfoSerializationTest()
        {
            WfClientJsonConverterHelper.Instance.RegisterConverters();

            WfProcessDescriptorInfo server = PrepareServerData();

            ClearServerData(server.ProcessKey);

            WfClientProcessDescriptorInfo client = null;

            WfClientProcessDescriptorInfoConverter.Instance.ServerToClient(server, ref client);

            string data = JSONSerializerExecute.Serialize(client);

            Console.WriteLine(data);

            WfClientProcessDescriptorInfo deserialized = JSONSerializerExecute.Deserialize <WfClientProcessDescriptorInfo>(data);

            client.AreSame(deserialized);
        }
        public WfProcessDescriptorInfo ClientToServer(WfClientProcessDescriptorInfo client, ref WfProcessDescriptorInfo server)
        {
            client.NullCheck("client");

            if (server == null)
                server = new WfProcessDescriptorInfo();

            server.ProcessKey = client.ProcessKey;
            server.ApplicationName = client.ApplicationName;
            server.ProgramName = client.ProgramName;
            server.ProcessName = client.ProcessName;
            server.CreateTime = client.CreateTime;
            server.Creator = (IUser)client.Creator.ToOguObject();
            server.Modifier = (IUser)client.Modifier.ToOguObject();
            server.ModifyTime = client.ModifyTime;
            server.Data = client.Data;
            server.Enabled = client.Enabled;
            server.ImportTime = client.ImportTime;
            server.ImportUser = (IUser)client.ImportUser.ToOguObject();

            return server;
        }
        public WfClientProcessDescriptorInfo ServerToClient(WfProcessDescriptorInfo server, ref WfClientProcessDescriptorInfo client)
        {
            server.NullCheck("server");

            if (client == null)
                client = new WfClientProcessDescriptorInfo();

            client.ProcessKey = server.ProcessKey;
            client.ApplicationName = server.ApplicationName;
            client.ProgramName = server.ProgramName;
            client.ProcessName = server.ProcessName;
            client.CreateTime = server.CreateTime;
            client.Creator = (WfClientUser)server.Creator.ToClientOguObject();
            client.Modifier = (WfClientUser)server.Modifier.ToClientOguObject();
            client.ModifyTime = server.ModifyTime;
            client.Data = server.Data;
            client.Enabled = server.Enabled;
            client.ImportTime = server.ImportTime;
            client.ImportUser = (WfClientUser)server.ImportUser.ToClientOguObject();

            return client;
        }
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            WfClientProcessDescriptorInfo processInfo = new WfClientProcessDescriptorInfo();

            processInfo.ProcessKey = dictionary.GetValue("processKey", string.Empty);
            processInfo.ProcessName = dictionary.GetValue("processName", string.Empty);

            processInfo.ApplicationName = dictionary.GetValue("applicationName", string.Empty);
            processInfo.ProgramName = dictionary.GetValue("programName", string.Empty);


            processInfo.Enabled = dictionary.GetValue("enabled", true);
            processInfo.Data = dictionary.GetValue("data", string.Empty);          
           
            processInfo.CreateTime = dictionary.GetValue("createTime", DateTime.MinValue);
            processInfo.ModifyTime = dictionary.GetValue("modifyTime", DateTime.MinValue);
            processInfo.ImportTime = dictionary.GetValue("importTime", DateTime.MinValue);   

            processInfo.Creator = JSONSerializerExecute.Deserialize<WfClientUser>(dictionary.GetValue("creator", (object)null));
            processInfo.Modifier = JSONSerializerExecute.Deserialize<WfClientUser>(dictionary.GetValue("modifier", (object)null));
            processInfo.ImportUser = JSONSerializerExecute.Deserialize<WfClientUser>(dictionary.GetValue("importUser", (object)null));
           
            return processInfo;
        }
示例#9
0
        public WfProcessDescriptorInfo ClientToServer(WfClientProcessDescriptorInfo client, ref WfProcessDescriptorInfo server)
        {
            client.NullCheck("client");

            if (server == null)
            {
                server = new WfProcessDescriptorInfo();
            }

            server.ProcessKey      = client.ProcessKey;
            server.ApplicationName = client.ApplicationName;
            server.ProgramName     = client.ProgramName;
            server.ProcessName     = client.ProcessName;
            server.CreateTime      = client.CreateTime;
            server.Creator         = (IUser)client.Creator.ToOguObject();
            server.Modifier        = (IUser)client.Modifier.ToOguObject();
            server.ModifyTime      = client.ModifyTime;
            server.Data            = client.Data;
            server.Enabled         = client.Enabled;
            server.ImportTime      = client.ImportTime;
            server.ImportUser      = (IUser)client.ImportUser.ToOguObject();

            return(server);
        }
示例#10
0
        public WfClientProcessDescriptorInfo ServerToClient(WfProcessDescriptorInfo server, ref WfClientProcessDescriptorInfo client)
        {
            server.NullCheck("server");

            if (client == null)
            {
                client = new WfClientProcessDescriptorInfo();
            }

            client.ProcessKey      = server.ProcessKey;
            client.ApplicationName = server.ApplicationName;
            client.ProgramName     = server.ProgramName;
            client.ProcessName     = server.ProcessName;
            client.CreateTime      = server.CreateTime;
            client.Creator         = (WfClientUser)server.Creator.ToClientOguObject();
            client.Modifier        = (WfClientUser)server.Modifier.ToClientOguObject();
            client.ModifyTime      = server.ModifyTime;
            client.Data            = server.Data;
            client.Enabled         = server.Enabled;
            client.ImportTime      = server.ImportTime;
            client.ImportUser      = (WfClientUser)server.ImportUser.ToClientOguObject();

            return(client);
        }
        public override IDictionary <string, object> Serialize(object obj, JavaScriptSerializer serializer)
        {
            WfClientProcessDescriptorInfo processInfo = (WfClientProcessDescriptorInfo)obj;
            Dictionary <string, object>   dictionary  = new Dictionary <string, object>();

            dictionary.AddNonDefaultValue("processKey", processInfo.ProcessKey);
            dictionary.AddNonDefaultValue("processName", processInfo.ProcessName);
            dictionary.AddNonDefaultValue("applicationName", processInfo.ApplicationName);
            dictionary.AddNonDefaultValue("programName", processInfo.ProgramName);


            dictionary.AddNonDefaultValue("data", processInfo.Data);
            dictionary.AddNonDefaultValue("enabled", processInfo.Enabled);

            dictionary.AddNonDefaultValue("createTime", processInfo.CreateTime);
            dictionary.AddNonDefaultValue("modifyTime", processInfo.ModifyTime);
            dictionary.AddNonDefaultValue("importTime", processInfo.ImportTime);

            dictionary.AddNonDefaultValue("creator", processInfo.Creator);
            dictionary.AddNonDefaultValue("modifier", processInfo.Modifier);
            dictionary.AddNonDefaultValue("importUser", processInfo.ImportUser);

            return(dictionary);
        }
        public override object Deserialize(IDictionary <string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            WfClientProcessDescriptorInfo processInfo = new WfClientProcessDescriptorInfo();

            processInfo.ProcessKey  = dictionary.GetValue("processKey", string.Empty);
            processInfo.ProcessName = dictionary.GetValue("processName", string.Empty);

            processInfo.ApplicationName = dictionary.GetValue("applicationName", string.Empty);
            processInfo.ProgramName     = dictionary.GetValue("programName", string.Empty);


            processInfo.Enabled = dictionary.GetValue("enabled", true);
            processInfo.Data    = dictionary.GetValue("data", string.Empty);

            processInfo.CreateTime = dictionary.GetValue("createTime", DateTime.MinValue);
            processInfo.ModifyTime = dictionary.GetValue("modifyTime", DateTime.MinValue);
            processInfo.ImportTime = dictionary.GetValue("importTime", DateTime.MinValue);

            processInfo.Creator    = JSONSerializerExecute.Deserialize <WfClientUser>(dictionary.GetValue("creator", (object)null));
            processInfo.Modifier   = JSONSerializerExecute.Deserialize <WfClientUser>(dictionary.GetValue("modifier", (object)null));
            processInfo.ImportUser = JSONSerializerExecute.Deserialize <WfClientUser>(dictionary.GetValue("importUser", (object)null));

            return(processInfo);
        }
        public static void AreSame(this WfClientProcessDescriptorInfo expected, WfClientProcessDescriptorInfo actual)
        {
            AssertStringEqual(expected.ProcessKey, actual.ProcessKey);
            AssertStringEqual(expected.ProcessName, actual.ProcessName);
            AssertStringEqual(expected.ApplicationName, actual.ApplicationName);
            AssertStringEqual(expected.ProgramName, actual.ProgramName);

            AssertStringEqual(expected.Data, actual.Data);
            Assert.AreEqual(expected.Enabled, actual.Enabled);

            Assert.AreEqual(expected.CreateTime, actual.CreateTime);
            Assert.AreEqual(expected.ModifyTime, actual.ModifyTime);
            Assert.AreEqual(expected.ImportTime, actual.ImportTime);

            expected.Creator.AreSame(actual.Creator);
            expected.Modifier.AreSame(actual.Modifier);
            expected.ImportUser.AreSame(actual.ImportUser);
        }