Exemplo n.º 1
0
        public void ShouldRollbackChangesToObject()
        {
            // arrange
            var obj = new MockEditableObject();
            var transaction = new FieldTransaction( obj, new[] { "LastModified" } );
            var lastModified = obj.LastModified;

            // act
            transaction.Begin();
            obj.LastModified = DateTime.Now;
            transaction.Rollback();

            // assert
            Assert.Equal( lastModified, obj.LastModified );
        }
Exemplo n.º 2
0
 public void ShouldNotSupportBeginNestedTransaction()
 {
     var target = new FieldTransaction( new MockEditableObject() );
     target.Begin();
     Assert.Throws<InvalidOperationException>( () => target.Begin() );
 }