コード例 #1
0
        public void MPT_DynamicProperties_Reflection()
        {
            var user = new TestUser();

            user.SetDynamicProperty("DynamicProperty", "Value1");
            user.SetDynamicProperty("DynamicProperty2", "Value2");

            var dpList = user.GetDynamicProperties();

            Assert.AreEqual(2, dpList.Count);
            Assert.IsTrue(dpList.ContainsKey("DynamicProperty"));
            Assert.IsTrue(dpList.ContainsKey("DynamicProperty2"));
            Assert.AreEqual("Value1", dpList["DynamicProperty"]);
            Assert.AreEqual("Value2", dpList["DynamicProperty2"]);
        }