Mercurial > pub > bltoolkit
comparison UnitTests/CS/Reflection/ExtendedPropertyDescriptorTest.cs @ 0:f990fcb411a9
Копия текущей версии из github
| author | cin |
|---|---|
| date | Thu, 27 Mar 2014 21:46:09 +0400 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:f990fcb411a9 |
|---|---|
| 1 using System; | |
| 2 using System.ComponentModel; | |
| 3 | |
| 4 using NUnit.Framework; | |
| 5 | |
| 6 using BLToolkit.Reflection; | |
| 7 | |
| 8 namespace Reflection | |
| 9 { | |
| 10 [TestFixture] | |
| 11 public class ExtendedPropertyDescriptorTest | |
| 12 { | |
| 13 public class RootType | |
| 14 { | |
| 15 private Type1 _type1 = new Type1(); | |
| 16 public Type1 Type1 { get { return _type1; } } | |
| 17 } | |
| 18 | |
| 19 public class Type1 | |
| 20 { | |
| 21 private Type2 _type2 = new Type2(); | |
| 22 public Type2 Type2 { get { return _type2; } } | |
| 23 } | |
| 24 | |
| 25 public class Type2 | |
| 26 { | |
| 27 public string Name | |
| 28 { | |
| 29 get { return "test"; } | |
| 30 } | |
| 31 } | |
| 32 | |
| 33 [Test] | |
| 34 public void Test() | |
| 35 { | |
| 36 TypeAccessor ta = TypeAccessor.GetAccessor(typeof(RootType)); | |
| 37 | |
| 38 PropertyDescriptorCollection col = ta.CreateExtendedPropertyDescriptors(null, null); | |
| 39 PropertyDescriptor prop = col["Type1+Type2+Name"]; | |
| 40 | |
| 41 RootType obj = new RootType(); | |
| 42 | |
| 43 object value = prop.GetValue(obj); | |
| 44 | |
| 45 Assert.AreEqual("test", value); | |
| 46 } | |
| 47 } | |
| 48 } |
