예제 #1
0
        public void TestAttributeUtilGetAsString()
        {
            TestClass2 item  = new TestClass2(7, "test", 0);
            string     value = AttributeUtil.GetAsString(() => item.Id, typeof(StringValueAttribute), "Value");

            Assert.IsNotNull(value);
            Assert.IsTrue(((string)value).StartsWith("IdTest"));
            value = AttributeUtil.GetAsString(() => item.Name, typeof(StringValueAttribute), "Value");
            Assert.AreEqual("NameTest", value);
            value = AttributeUtil.GetAsString(() => item.Age, typeof(StringValueAttribute), "Value");
            Assert.IsNull(value);
        }