예제 #1
0
        public void SetIsSelected_Does_Not_Fire_SelectionChanged_Event_If_The_SelectionOrigin_Is_UI()
        {
            var element = new DataPropertiesElement();
            var source = SelectionSource.Code;
            var origin = SelectionOrigin.UI;

            var helper = new HelperForElements();
            element.SelectionChanged += new SelectionEventHandler<IElement, SelectionEventArgs>(helper.SelectionChanged_DummyHandler);

            Assert.False(element.IsSelected);
            element.SetIsSelected(true, source, origin);
            Assert.Equal(0, helper.SelectionChanged_TimesCalled);
            Assert.True(element.IsSelected);
        }
예제 #2
0
        public void SetIsSelected_Updates_The_IsSelected_Flag_If_The_Value_Changes()
        {
            var element = new DataPropertiesElement();
            // origin will not effect of the flag is updated. ,just may not allow the event to be fired.
            var origin = SelectionOrigin.None;

            var helper = new HelperForElements();
            element.SelectionChanged += new SelectionEventHandler<IElement, SelectionEventArgs>(helper.SelectionChanged_DummyHandler);

            Assert.False(element.IsSelected);
            element.SetIsSelected(true, SelectionSource.Mouse, origin);
            Assert.Equal(0, helper.SelectionChanged_TimesCalled);
            Assert.True(element.IsSelected);
        }