コード例 #1
0
ファイル: LazyLoadTests.cs プロジェクト: RobRobertsCE/MVVM
        public void NullApplyEdit()
        {
            AParent parent = new AParent();

            Assert.IsNull(parent.GetChildList(), "GetChildList should be null");

            parent.BeginEdit();
            AChildList list = parent.ChildList;

            Assert.IsNotNull(list, "ChildList should not be null");
            Assert.IsNotNull(parent.GetChildList(), "GetChildList should not be null");

            parent.ApplyEdit();
            Assert.IsNotNull(parent.GetChildList(), "GetChildList should not be null after ApplyEdit");
        }
コード例 #2
0
ファイル: LazyLoadTests.cs プロジェクト: RobRobertsCE/MVVM
        public void NewChildEditLevelCancel()
        {
            AParent parent = new AParent();

            Assert.IsNull(parent.GetChildList(), "GetChildList should be null");

            parent.BeginEdit();
            AChildList list = parent.ChildList;

            Assert.IsNotNull(list, "ChildList should not be null");
            Assert.IsNotNull(parent.GetChildList(), "GetChildList should not be null");

            Assert.AreEqual(1, parent.EditLevel, "Parent edit level should be 1");
            Assert.AreEqual(1, list.EditLevel, "Child list edit level should be 1");
            Assert.AreEqual(1, list[0].EditLevel, "Child edit level should be 1");

            parent.CancelEdit();
            Assert.AreEqual(0, parent.EditLevel, "Parent edit level should be 0");
            Assert.IsNull(parent.GetChildList(), "GetChildList should be null after CancelEdit");
        }
コード例 #3
0
ファイル: LazyLoadTests.cs プロジェクト: gnilesh4/csla
        public void NewChildEditLevel()
        {
            AParent parent = CreateAParent();

            Assert.IsNull(parent.GetChildList(), "GetChildList should be null");

            parent.BeginEdit();
            AChildList list = parent.ChildList;

            Assert.IsNotNull(list, "ChildList should not be null");
            Assert.IsNotNull(parent.GetChildList(), "GetChildList should not be null");

            Assert.AreEqual(1, parent.EditLevel, "Parent edit level should be 1");
            Assert.AreEqual(1, list.EditLevel, "Child list edit level should be 1");
            Assert.AreEqual(1, list[0].EditLevel, "Child edit level should be 1");

            parent.BeginEdit();
            Assert.AreEqual(2, parent.EditLevel, "Parent edit level should be 2");
            Assert.AreEqual(2, list.EditLevel, "Child list edit level should be 2");
            Assert.AreEqual(2, list[0].EditLevel, "Child edit level should be 2");
        }
コード例 #4
0
ファイル: LazyLoadTests.cs プロジェクト: RobRobertsCE/MVVM
        public void NullCancelEdit()
        {
            AParent parent = new AParent();

            Assert.IsNull(parent.GetChildList(), "GetChildList should be null");

            parent.BeginEdit();
            AChildList list = parent.ChildList;

            Assert.IsNotNull(list, "ChildList should not be null");
            Assert.IsNotNull(parent.GetChildList(), "GetChildList should not be null");

            parent.BeginEdit();
            list = parent.ChildList;
            Assert.IsNotNull(list, "ChildList should not be null");
            Assert.IsNotNull(parent.GetChildList(), "GetChildList should not be null after 2nd BeginEdit");

            parent.CancelEdit();
            Assert.IsNotNull(parent.GetChildList(), "GetChildList should not be null after 1st CancelEdit");

            parent.CancelEdit();
            Assert.IsNull(parent.GetChildList(), "GetChildList should be null after CancelEdit");
        }