Пример #1
0
        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 );
        }
Пример #2
0
 public void ShouldNotCommitUnstartedTransaction()
 {
     var target = new FieldTransaction( new MockEditableObject() );
     Assert.Throws<InvalidOperationException>( () => target.Commit() );
 }