0
|
1 using System;
|
|
2 using NUnit.Framework;
|
|
3 using BLToolkit.EditableObjects;
|
|
4
|
|
5 namespace HowTo.EditableObjects
|
|
6 {
|
|
7 [TestFixture]
|
|
8 public class PropertyChanged
|
|
9 {
|
|
10 public /*[a]*/abstract/*[/a]*/ class TestObject : /*[a]*/EditableObject/*[/a]*/<TestObject>
|
|
11 {
|
|
12 public /*[a]*/abstract/*[/a]*/ string FirstName { get; set; }
|
|
13 public /*[a]*/abstract/*[/a]*/ string LastName { get; set; }
|
|
14 }
|
|
15
|
|
16 [Test]
|
|
17 public void Test()
|
|
18 {
|
|
19 TestObject obj = TestObject./*[a]*/CreateInstance/*[/a]*/();
|
|
20
|
|
21 bool proprtyName = null;
|
|
22
|
|
23 obj./*[a]*/PropertyChanged/*[/a]*/ += (s, e) => proprtyName = e.PropertyName;
|
|
24
|
|
25 Assert.IsNull(propertyName);
|
|
26
|
|
27 obj.FirstName = "Tester";
|
|
28
|
|
29 Assert.AreEqual(proprtyName, "FirstName");
|
|
30
|
|
31 bool proprtyName = null;
|
|
32
|
|
33 obj.AcceptChanges();
|
|
34 }
|
|
35 }
|
|
36 }
|