コード例 #1
0
        public void TestMarkDeletedOnDirty()
        {
            _controller.BeginChanges(_entityClean);
            _entityClean.Name = "new name";
            _entityClean.Age  = 99;
            Assert.AreEqual("new name", _entityClean.Name);
            Assert.AreEqual(99, _entityClean.Age);

            _controller.MarkAsDeleted(_entityClean);
            Assert.AreEqual(EntityStatus.ToBeDeleted, _entityClean.Status);

            //Deleting a dirty entity must result in it being reset to its original values,
            //so that a call to CancelChanges can safely turn it back to clean.
            Assert.AreEqual("I'm clean", _entityClean.Name);
            Assert.AreEqual(2, _entityClean.Age);
        }