コード例 #1
0
 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));
 }
コード例 #2
0
        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));
        }
コード例 #3
0
        /// <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();
        }
コード例 #4
0
        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));
        }
コード例 #5
0
        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));
        }