public void OnNoCommitEditTest() { ShallowCopyEditableObject target = new ShallowCopyEditableObject(); TestClass1 tc = new TestClass1(); target.OnBeginEdit(tc); tc.S1 = "Hello"; tc.i1 = 10; tc.db1 = 1.00; tc.dt = DateTime.Now; target.OnEndEdit(tc, false); Assert.AreEqual("Test123", tc.S1); Assert.AreEqual(30, tc.i1); Assert.AreEqual(3.14, tc.db1); Assert.AreEqual(new DateTime(2010, 12, 25, 12, 59, 59), tc.dt); }
public void OnCommitEditTest() { ShallowCopyEditableObject target = new ShallowCopyEditableObject(); TestClass1 tc = new TestClass1(); DateTime td = DateTime.Now; target.OnBeginEdit(tc); tc.S1 = "Hello"; tc.i1 = 10; tc.db1 = 1.00; tc.dt = td; target.OnEndEdit(tc, true); Assert.AreEqual("Hello", tc.S1); Assert.AreEqual(10, tc.i1); Assert.AreEqual(1.0, tc.db1); Assert.AreEqual(td, tc.dt); }
public void OnPartialCommitEditTest() { ShallowCopyEditableObject target = new ShallowCopyEditableObject(); TestClass1 tc = new TestClass1(); tc.FieldPredicate = fi => fi.Name != "_s1"; DateTime td = DateTime.Now; target.OnBeginEdit(tc); tc.S1 = "Hello"; tc.i1 = 10; tc.db1 = 1.00; tc.dt = td; target.OnEndEdit(tc, false); Assert.AreEqual("Hello", tc.S1); Assert.AreEqual(30, tc.i1); Assert.AreEqual(3.14, tc.db1); Assert.AreEqual(new DateTime(2010, 12, 25, 12, 59, 59), tc.dt); }