Esempio n. 1
0
        public void EditParentEntity()
        {
            Csla.Test.DataBinding.ParentEntity p = Csla.Test.DataBinding.ParentEntity.NewParentEntity();
            p.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(p_PropertyChanged);

            p.BeginEdit();
            p.Data = "something";
            p.BeginEdit();
            p.CancelEdit();
            p.CancelEdit();

            Assert.AreEqual(string.Empty, p.Data);

            p.BeginEdit();
            p.BeginEdit();
            p.Data = "data";
            p.ApplyEdit();
            p.CancelEdit();

            Assert.AreEqual(string.Empty, p.Data);

            p.Data = "data";
            p.BeginEdit();
            p.Data += " more data";
            p.ApplyEdit();
            p.CancelEdit();

            Assert.AreEqual("data more data", p.Data);
        }
Esempio n. 2
0
        public void TestNotUndoableField()
        {
            Csla.ApplicationContext.GlobalContext.Clear();
            Csla.Test.DataBinding.ParentEntity p = Csla.Test.DataBinding.ParentEntity.NewParentEntity();

            p.NotUndoable = "something";
            p.Data        = "data";
            p.BeginEdit();
            p.NotUndoable = "something else";
            p.Data        = "new data";
            p.CancelEdit();
            //NotUndoable property points to a private field marked with [NotUndoable()]
            //so its state is never copied when BeginEdit() is called
            Assert.AreEqual("something else", p.NotUndoable);
            //the Data property points to a field that is undoable, so it reverts
            Assert.AreEqual("data", p.Data);
        }
Esempio n. 3
0
        public void TestNotUndoableField()
        {
            TestResults.Reinitialise();

            Csla.Test.DataBinding.ParentEntity p = CreateParentEntityInstance();

            p.NotUndoable = "something";
            p.Data        = "data";
            p.BeginEdit();
            p.NotUndoable = "something else";
            p.Data        = "new data";
            p.CancelEdit();
            //NotUndoable property points to a private field marked with [NotUndoable()]
            //so its state is never copied when BeginEdit() is called
            Assert.AreEqual("something else", p.NotUndoable);
            //the Data property points to a field that is undoable, so it reverts
            Assert.AreEqual("data", p.Data);
        }