public void ShouldCommitChangesToObject() { // arrange var obj = new MockEditableObject(); var transaction = new FieldTransaction( obj, new[] { "LastModified" } ); var lastModified = DateTime.Now; // act transaction.Begin(); obj.LastModified = lastModified; transaction.Commit(); // assert Assert.Equal( lastModified, obj.LastModified ); }
public void ShouldNotCommitUnstartedTransaction() { var target = new FieldTransaction( new MockEditableObject() ); Assert.Throws<InvalidOperationException>( () => target.Commit() ); }