Пример #1
0
        public void SetIsSelected_Does_Not_Fire_SelectionChangedEvent_If_The_SelectionOrigin_Is_Data()
        {
            var element = new ImportNetworkElement();
            var source = SelectionSource.Code;
            var origin = SelectionOrigin.Data;

            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 ImportNetworkElement();
            // 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);
        }