public static void AreSame(this WfClientApprovalMatrix expected, WfClientApprovalMatrix actual) { AssertStringEqual(expected.ID, actual.ID); AreSame(expected.PropertyDefinitions, actual.PropertyDefinitions); AreSame(expected.Rows, actual.Rows); }
public WfClientApprovalMatrix ServerToClient(WfApprovalMatrix server, ref WfClientApprovalMatrix client) { server.NullCheck("server"); if (client == null) { client = new WfClientApprovalMatrix(); } client.ID = server.ID; foreach (SOARolePropertyDefinition spd in server.PropertyDefinitions) { WfClientRolePropertyDefinition cpd = null; WfClientRolePropertyDefinitionConverter.Instance.ServerToClient(spd, ref cpd); client.PropertyDefinitions.Add(cpd); } foreach (SOARolePropertyRow sRow in server.Rows) { WfClientRolePropertyRow cRow = null; WfClientRolePropertyRowConverter.Instance.ServerToClient(sRow, client.PropertyDefinitions, ref cRow); client.Rows.Add(cRow); } return(client); }
public WfApprovalMatrix ClientToServer(WfClientApprovalMatrix client, ref WfApprovalMatrix server) { client.NullCheck("client"); if (server == null) { server = new WfApprovalMatrix(); } server.ID = client.ID; foreach (WfClientRolePropertyDefinition cpd in client.PropertyDefinitions) { SOARolePropertyDefinition spd = null; WfClientRolePropertyDefinitionConverter.Instance.ClientToServer(cpd, ref spd); server.PropertyDefinitions.Add(spd); } foreach (WfClientRolePropertyRow cRow in client.Rows) { SOARolePropertyRow sRow = null; WfClientRolePropertyRowConverter.Instance.ClientToServer(cRow, server.PropertyDefinitions, ref sRow); server.Rows.Add(sRow); } return(server); }
public void SimpleServerApprovalMatrixToClient() { WfApprovalMatrix server = ApprovalMatrixHelper.PrepareServerApprovalMatrix(); WfClientApprovalMatrix client = null; WfClientApprovalMatrixConverter.Instance.ServerToClient(server, ref client); client.AreSame(server); }
public void SimpleClientApprovalMatrixToServer() { WfClientApprovalMatrix client = ApprovalMatrixHelper.PrepareClientApprovalMatrix(); WfApprovalMatrix server = null; WfClientApprovalMatrixConverter.Instance.ClientToServer(client, ref server); client.AreSame(server); }
public override object Deserialize(IDictionary <string, object> dictionary, Type type, JavaScriptSerializer serializer) { WfClientApprovalMatrix resource = new WfClientApprovalMatrix(); resource.ID = dictionary.GetValue("id", string.Empty); JSONSerializerExecute.FillDeserializedCollection(dictionary["definitions"], resource.PropertyDefinitions); JSONSerializerExecute.FillDeserializedCollection(dictionary["rows"], resource.Rows); return(resource); }
public static WfClientApprovalMatrix PrepareClientApprovalMatrix() { WfClientApprovalMatrix matrix = new WfClientApprovalMatrix() { ID = UuidHelper.NewUuidString() }; matrix.PropertyDefinitions.CopyFrom(PrepareClientPropertiesDefinition()); matrix.Rows.CopyFrom(PrepareClientRows(matrix.PropertyDefinitions)); return(matrix); }
public override IDictionary <string, object> Serialize(object obj, JavaScriptSerializer serializer) { IDictionary <string, object> dictionary = new Dictionary <string, object>(); WfClientApprovalMatrix resource = (WfClientApprovalMatrix)obj; dictionary["id"] = resource.ID; dictionary["definitions"] = resource.PropertyDefinitions; dictionary["rows"] = resource.Rows; resource.Rows.FillColumnInfoToRowValues(resource.PropertyDefinitions); return(dictionary); }
public void ClientApprovalMatrixDescriptorSerializationTest() { WfClientJsonConverterHelper.Instance.RegisterConverters(); WfClientApprovalMatrix matrix = ApprovalMatrixHelper.PrepareClientApprovalMatrix(); string data = JSONSerializerExecute.Serialize(matrix); Console.WriteLine(data); WfClientApprovalMatrix deserialized = JSONSerializerExecute.Deserialize <WfClientApprovalMatrix>(data); matrix.AreSame(deserialized); }
public void ClientApprovalMatrixToExcelTest() { WfClientApprovalMatrix matrix = ApprovalMatrixHelper.PrepareClientApprovalMatrix(); WorkBook workBook = matrix.ToWorkBook(); workBook.Save("ClientApprovalMatrixToExcelTest.xlsx"); WfClientApprovalMatrix deserialized = workBook.ToApprovalMatrix(); deserialized.ID = matrix.ID; matrix.AreSame(deserialized); }