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