Example #1
0
        public void UpdateWfProcessDescriptorInfoTest()
        {
            WfProcessDescriptorInfo processInfo = PrepareProcessDescriptorInfo();

            WfProcessDescriptorInfoAdapter.Instance.Update(processInfo);

            WfProcessDescriptorInfo loadedProcessInfo = WfProcessDescriptorInfoAdapter.Instance.Load(processInfo.ProcessKey);

            try
            {
                Assert.AreEqual(processInfo.ProcessKey, loadedProcessInfo.ProcessKey);
                Assert.AreEqual(processInfo.ApplicationName, loadedProcessInfo.ApplicationName);
                Assert.AreEqual(processInfo.ProgramName, loadedProcessInfo.ProgramName);
                Assert.AreEqual(processInfo.ProcessName, loadedProcessInfo.ProcessName);

                XElement root = XElement.Parse(loadedProcessInfo.Data);

                Assert.AreEqual(processInfo.Data, root.ToString(), "字符串的格式不同");

                Assert.AreEqual(processInfo.Creator.ID, loadedProcessInfo.Creator.ID);
                Assert.AreEqual(processInfo.Creator.Name, loadedProcessInfo.Creator.Name);

                //Assert.AreEqual(processInfo.Modifier.ID, loadedProcessInfo.Modifier.ID);
                //Assert.AreEqual(processInfo.Modifier.Name, loadedProcessInfo.Modifier.Name);

                Assert.IsTrue(loadedProcessInfo.CreateTime != DateTime.MinValue);
                //Assert.IsTrue(loadedProcessInfo.ModifyTime != DateTime.MinValue);
            }
            finally
            {
                WfProcessDescriptorInfoAdapter.Instance.Delete(loadedProcessInfo);
            }
        }
Example #2
0
        public void UpdateWfProcessDescriptorInfoWithTenantCodeTest()
        {
            TenantContext.Current.TenantCode = "1001";

            WfProcessDescriptorInfo processInfo = PrepareProcessDescriptorInfo();

            WfProcessDescriptorInfoAdapter.Instance.Update(processInfo);
        }
Example #3
0
        private static WfProcessDescriptorInfo PrepareProcessDescriptorInfo()
        {
            IWfProcessDescriptor processDesp = WfProcessTestCommon.CreateSimpleProcessDescriptor();

            WfProcessDescriptorInfo processInfo = WfProcessDescriptorInfo.FromProcessDescriptor(processDesp);

            processInfo.Creator  = (IUser)OguObjectSettings.GetConfig().Objects["requestor"].Object;
            processInfo.Modifier = (IUser)OguObjectSettings.GetConfig().Objects["approver1"].Object;

            return(processInfo);
        }
        public void WfProcessDescriptorInfoToClientTest()
        {
            WfProcessDescriptorInfo server = PrepareServerData();

            ClearServerData(server.ProcessKey);

            WfClientProcessDescriptorInfo client = null;

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

            client.AreSame(server);
        }
        private static WfProcessDescriptorInfo PrepareServerData()
        {
            WfClientUser[] users = new WfClientUser[] { Consts.Users["Requestor"] };

            IWfProcessDescriptor processDesp = ProcessHelper.CreateFreeStepsProcess(users.ToOguObjects <WfClientUser, IUser>().ToArray());

            WfSqlProcessDescriptorManager manager = new WfSqlProcessDescriptorManager();

            manager.SaveDescriptor(processDesp);
            WfProcessDescriptorInfo server = WfProcessDescriptorInfoAdapter.Instance.Load(processDesp.Key);

            return(server);
        }
Example #6
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;
        }
Example #10
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);
        }
Example #11
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 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);

        }