comparison HowTo/EditableObjects/EditableObjectTest.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 NUnit.Framework;
3 using BLToolkit.EditableObjects;
4
5 namespace HowTo.EditableObjects
6 {
7 [TestFixture]
8 public class EditableObjectTest
9 {
10 public /*[a]*/abstract/*[/a]*/ class TestObject : /*[a]*/EditableObject/*[/a]*/<TestObject>
11 {
12 // Any abstract property becomes editable.
13 //
14 public /*[a]*/abstract/*[/a]*/ string FirstName { get; set; }
15 public /*[a]*/abstract/*[/a]*/ string LastName { get; set; }
16
17 // This field is not editable.
18 //
19 public string FullName
20 {
21 get { return string.Format("{0} {1}", FirstName, LastName); }
22 }
23 }
24
25 [Test]
26 public void Test()
27 {
28 TestObject obj = TestObject./*[a]*/CreateInstance/*[/a]*/();
29
30 obj.FirstName = "Tester";
31 obj.LastName = "Testerson";
32
33 Assert.IsTrue(obj.IsDirty);
34
35 obj.AcceptChanges();
36
37 Assert.IsFalse(obj.IsDirty);
38 }
39 }
40 }