private static void MergeProperties(ClientPropertyValueCollection target, ClientPropertyValueCollection source) { foreach (ClientPropertyValue pv in source) { target.AddOrSetValue(pv.Key, pv.StringValue); } }
public static void CopyFrom(this SchemaPropertyValueCollection pcProperties, ClientPropertyValueCollection clientProperties) { pcProperties.NullCheck("pcProperties"); foreach (var ppt in clientProperties) { pcProperties[ppt.Key].StringValue = ppt.StringValue; } }
public static void CopyFrom(this SchemaPropertyValueCollection pcProperties, ClientPropertyValueCollection clientProperties) { pcProperties.NullCheck("pcProperties"); foreach (var ppt in clientProperties) { pcProperties[ppt.Key].StringValue = ppt.StringValue; } }
/// <summary> /// 如果目标集合中不存在,则添加一项 /// </summary> /// <param name="pvc"></param> /// <param name="cpvc"></param> public void ServerToClient(IEnumerable <PropertyValue> pvc, ClientPropertyValueCollection cpvc) { pvc.NullCheck("pvc"); cpvc.NullCheck("cpvc"); foreach (PropertyValue pv in pvc) { ClientPropertyValue cpv = cpvc[pv.Definition.Name]; if (cpv == null) { cpv = new ClientPropertyValue(pv.Definition.Name); cpvc.Add(cpv); } ClientPropertyValueConverter.Instance.ServerToClient(pv, cpv); } }
/// <summary> /// 如果目标集合中不存在,则添加一项 /// </summary> /// <param name="pvc"></param> /// <param name="cpvc"></param> public void ServerToClient(IEnumerable<PropertyValue> pvc, ClientPropertyValueCollection cpvc) { pvc.NullCheck("pvc"); cpvc.NullCheck("cpvc"); foreach (PropertyValue pv in pvc) { ClientPropertyValue cpv = cpvc[pv.Definition.Name]; if (cpv == null) { cpv = new ClientPropertyValue(pv.Definition.Name); cpvc.Add(cpv); } ClientPropertyValueConverter.Instance.ServerToClient(pv, cpv); } }
public void StandardServerPropertiesToClient() { PropertyValueCollection spc = PrepareServerProperties(); spc.SetValue("Key", "N0"); spc.SetValue("Name", "Shen Zheng"); spc.SetValue("Description", "Shen Zheng's s to c property set"); spc.SetValue("Enabled", true); ClientPropertyValueCollection cpvc = new ClientPropertyValueCollection(); ClientPropertyValueCollectionConverter.Instance.ServerToClient(spc, cpvc); OutputClientProperties(cpvc); Assert.AreEqual(spc.GetValue("Key", string.Empty), cpvc.GetValue("Key", string.Empty)); Assert.AreEqual(spc.GetValue("Name", string.Empty), cpvc.GetValue("Name", string.Empty)); Assert.AreEqual(spc.GetValue("Description", string.Empty), cpvc.GetValue("Description", string.Empty)); Assert.AreEqual(spc.GetValue("Enabled", false), cpvc.GetValue("Enabled", false)); }
public void StandardClientPropertiesToServer() { ClientPropertyValueCollection cpvc = new ClientPropertyValueCollection(); cpvc.AddOrSetValue("Key", "N0"); cpvc.AddOrSetValue("Name", "Shen Zheng"); cpvc.AddOrSetValue("Description", "Shen Zheng's c to s property set"); cpvc.AddOrSetValue("Enabled", true); PropertyValueCollection spc = PrepareServerProperties(); ClientPropertyValueCollectionConverter.Instance.ClientToServer(cpvc, spc); OutputServerProperties(spc); Assert.AreEqual(cpvc.GetValue("Key", string.Empty), spc.GetValue("Key", string.Empty)); Assert.AreEqual(cpvc.GetValue("Name", string.Empty), spc.GetValue("Name", string.Empty)); Assert.AreEqual(cpvc.GetValue("Description", string.Empty), spc.GetValue("Description", string.Empty)); Assert.AreEqual(cpvc.GetValue("Enabled", false), spc.GetValue("Enabled", false)); }
public void StandardServerPropertiesToClient() { PropertyValueCollection spc = PrepareServerProperties(); spc.SetValue("Key", "N0"); spc.SetValue("Name", "Shen Zheng"); spc.SetValue("Description", "Shen Zheng's s to c property set"); spc.SetValue("Enabled", true); ClientPropertyValueCollection cpvc = new ClientPropertyValueCollection(); ClientPropertyValueCollectionConverter.Instance.ServerToClient(spc, cpvc); OutputClientProperties(cpvc); Assert.AreEqual(spc.GetValue("Key", string.Empty), cpvc.GetValue("Key", string.Empty)); Assert.AreEqual(spc.GetValue("Name", string.Empty), cpvc.GetValue("Name", string.Empty)); Assert.AreEqual(spc.GetValue("Description", string.Empty), cpvc.GetValue("Description", string.Empty)); Assert.AreEqual(spc.GetValue("Enabled", false), cpvc.GetValue("Enabled", false)); }
public void StandardClientPropertiesToServer() { ClientPropertyValueCollection cpvc = new ClientPropertyValueCollection(); cpvc.AddOrSetValue("Key", "N0"); cpvc.AddOrSetValue("Name", "Shen Zheng"); cpvc.AddOrSetValue("Description", "Shen Zheng's c to s property set"); cpvc.AddOrSetValue("Enabled", true); PropertyValueCollection spc = PrepareServerProperties(); ClientPropertyValueCollectionConverter.Instance.ClientToServer(cpvc, spc); OutputServerProperties(spc); Assert.AreEqual(cpvc.GetValue("Key", string.Empty), spc.GetValue("Key", string.Empty)); Assert.AreEqual(cpvc.GetValue("Name", string.Empty), spc.GetValue("Name", string.Empty)); Assert.AreEqual(cpvc.GetValue("Description", string.Empty), spc.GetValue("Description", string.Empty)); Assert.AreEqual(cpvc.GetValue("Enabled", false), spc.GetValue("Enabled", false)); }
private static void OutputClientProperties(ClientPropertyValueCollection cpc) { cpc.ForEach(pv => Console.WriteLine("{0}: {1}", pv.Key, pv.StringValue)); }
public static void CopyTo(this SchemaPropertyValueCollection pcProperties, ClientPropertyValueCollection clientProperties) { pcProperties.NullCheck("pcProperties"); pcProperties.ForEach(pcpv => clientProperties.Add(pcpv.ToClientPropertyValue())); }
private static void MergeProperties(ClientPropertyValueCollection target, ClientPropertyValueCollection source) { foreach (ClientPropertyValue pv in source) target.AddOrSetValue(pv.Key, pv.StringValue); }
public static void CopyTo(this SchemaPropertyValueCollection pcProperties, ClientPropertyValueCollection clientProperties) { pcProperties.NullCheck("pcProperties"); pcProperties.ForEach(pcpv => clientProperties.Add(pcpv.ToClientPropertyValue())); }
private static void OutputClientProperties(ClientPropertyValueCollection cpc) { cpc.ForEach(pv => Console.WriteLine("{0}: {1}", pv.Key, pv.StringValue)); }