Ejemplo n.º 1
0
        public void AcceptChangesShouldCreateNewSavepoint()
        {
            // arrange
            var target = new MockEditableObject();

            target.RecoveryModel = EditRecoveryModel.Full;
            target.Id = 5;
            target.FirstName = "bill";
            target.LastName = "mei";
            target.AcceptChanges();

            // act
            target.BeginEdit();
            target.FirstName = "john";
            target.LastName = "doe";
            target.EndEdit();
            target.AcceptChanges();

            target.BeginEdit();
            target.FirstName = "jane";
            target.LastName = "doe";
            target.EndEdit();

            target.RejectChanges();

            // assert
            Assert.False( target.IsChanged );
            Assert.Equal( "john", target.FirstName );
            Assert.Equal( "doe", target.LastName );
        }
Ejemplo n.º 2
0
        public void RejectChangesShouldSignalNoChanges()
        {
            // arrange
            var target = new MockEditableObject();

            target.Id = 5;
            target.LastName = "bill";
            target.FirstName = "mei";

            // act
            var changed = target.IsChanged;
            target.RejectChanges();

            // assert
            Assert.True( changed );
            Assert.False( target.IsChanged );
        }