0
|
1 using NUnit.Framework;
|
|
2
|
|
3 using BLToolkit.EditableObjects;
|
|
4 using BLToolkit.Reflection;
|
|
5 using BLToolkit.TypeBuilder;
|
|
6
|
|
7 namespace TypeBuilder
|
|
8 {
|
|
9 [TestFixture]
|
|
10 public class NoInstanceAttributeTest2
|
|
11 {
|
|
12 public abstract class PersonCitizenship : EditableObject
|
|
13 {
|
|
14 }
|
|
15
|
|
16 public abstract class Person : EditableObject
|
|
17 {
|
|
18 [NoInstance]
|
|
19 public abstract PersonCitizenship Citizenship { get; set; }
|
|
20 }
|
|
21
|
|
22 [Test]
|
|
23 public void Text()
|
|
24 {
|
|
25 Person person = (Person)TypeAccessor.CreateInstance(typeof(Person));
|
|
26
|
|
27 Assert.IsNull(person.Citizenship);
|
|
28
|
|
29 person.Citizenship = (PersonCitizenship)TypeAccessor.CreateInstance(typeof(PersonCitizenship));
|
|
30
|
|
31 Assert.IsNotNull(person.Citizenship);
|
|
32 }
|
|
33 }
|
|
34 }
|