0
|
1 using System;
|
|
2
|
|
3 using NUnit.Framework;
|
|
4
|
|
5 using BLToolkit.Mapping;
|
|
6
|
|
7 namespace Mapping
|
|
8 {
|
|
9 [TestFixture, Category("Mapping")]
|
|
10 public class TrimmableAttributeTest
|
|
11 {
|
|
12 [Trimmable]
|
|
13 interface Interface1
|
|
14 {
|
|
15 }
|
|
16
|
|
17 public class TestObject : Interface1
|
|
18 {
|
|
19 [Trimmable(false)]
|
|
20 public string Str1;
|
|
21 public string Str2;
|
|
22 }
|
|
23
|
|
24 [Test]
|
|
25 public void Test()
|
|
26 {
|
|
27 ObjectMapper om = Map.GetObjectMapper(typeof(TestObject));
|
|
28
|
|
29 TestObject o = new TestObject();
|
|
30
|
|
31 om.SetValue(o, "Str1", "1 ");
|
|
32 om.SetValue(o, "Str2", "2 ");
|
|
33
|
|
34 Assert.AreEqual("1 ", o.Str1);
|
|
35 Assert.AreEqual("2", o.Str2);
|
|
36 }
|
|
37 }
|
|
38 }
|