private static void AssertBasicDictionaryProperties(Dictionary <string, object> dictionary, PropertyValueCollection pvs) { Assert.AreEqual(dictionary["Name"], pvs.GetValue("Name", string.Empty)); Assert.AreEqual(dictionary["Age"], pvs.GetValue("Age", 0)); Assert.AreEqual(dictionary["Salary"], pvs.GetValue("Salary", (Decimal)0)); Assert.AreEqual(dictionary["Birthday"], pvs.GetValue("Birthday", DateTime.Now)); Assert.AreEqual(dictionary["IsMale"], pvs.GetValue("IsMale", false)); }
public void OneTypedPropertyValueShouldBeReaded(PropertyValueCollection collection) { // Fixture setup // Exercise system collection.SetValue(DirectoryProperty.Member, john); // Verify outcome collection.GetValue <DN>(DirectoryProperty.Member).Should().Be(DN.Parse(john)); }
/// <summary> /// 将sourceProperties同步到targetProperties中 /// </summary>targetProperties /// <param name="sourceProperties"></param> /// <param name="targetProperties"></param> private void MergePropertyValues(T targetDescriptor, PropertyValueCollection sourceProperties, PropertyValueCollection targetProperties) { string originalKey = targetProperties.GetValue("Key", string.Empty); targetProperties.ReplaceExistedPropertyValues(sourceProperties); targetProperties.SetValue("Key", originalKey); targetDescriptor.SyncPropertiesToFields(); }
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)); }