コード例 #1
0
ファイル: HelpersTests.cs プロジェクト: jannisk/VideoRent
        public void BindingListAttacher_MoveItemInOwner()
        {
            bool resetIsRaised  = false;
            bool removeIsRaised = false;
            ObservableCollection <object> bindingList = new ObservableCollection <object> {
                1, 2, 3, 4
            };

            bindingList.CollectionChanged += (s, e) =>
            {
                switch (e.Action)
                {
                case NotifyCollectionChangedAction.Reset: resetIsRaised = true; break;

                case NotifyCollectionChangedAction.Remove: removeIsRaised = true; break;
                }
            };
            TestAttachedBindingListOwner listOwner = new TestAttachedBindingListOwner();
            BindingListAttacher          bla       = new BindingListAttacher(listOwner);

            bla.BindingList = bindingList;
            bla.BindingListAllowItemMoving = false;
            Assert.AreEqual("ResetList", listOwner.Log);
            resetIsRaised  = false;
            removeIsRaised = false;
            listOwner.MoveItem(0, 2);
            Assert.IsFalse(resetIsRaised);
            Assert.IsFalse(removeIsRaised);
        }
コード例 #2
0
ファイル: HelpersTests.cs プロジェクト: jannisk/VideoRent
        public void BindingList_AutoidentXPCollection()
        {
            TestAttachedBindingListOwner listOwner = new TestAttachedBindingListOwner();
            BindingListAttacher          bla       = new BindingListAttacher(listOwner);

            bla.BindingList = new ObservableCollection <object>();
            Assert.IsTrue(bla.BindingListAllowItemMoving);
            bla.BindingList = new XPCollection();
            Assert.IsFalse(bla.BindingListAllowItemMoving);
        }