Beispiel #1
0
        public static IScrollPattern GetScrollPattern(PatternsData data)
        {
            IScrollPattern scrollPattern = Substitute.For <IScrollPattern>();

            // scrollPattern.Scroll(Arg.Any<ScrollAmount>(), Arg.Any<ScrollAmount>()).Returns(new[] { data.ScrollPattern_HorizontalAmount, data.ScrollPattern_VerticalAmount });
            // scrollPattern.ScrollHorizontal(Arg.Any<ScrollAmount>()).Returns(data.ScrollPattern_HorizontalAmount);
            // scrollPattern.ScrollVertical(Arg.Any<ScrollAmount>()).Returns(data.ScrollPattern_VerticalAmount);
            // scrollPattern.SetScrollPercent(Arg.Any<double>(), Arg.Any<double>()).Returns(new[] { data.ScrollPattern_HorizontalPercent, data.ScrollPattern_VerticalPercent });

            scrollPattern.Current.HorizontallyScrollable.Returns(data.ScrollPattern_HorizontallyScrollable);
            scrollPattern.Current.HorizontalScrollPercent.Returns(data.ScrollPattern_HorizontalScrollPercent);
            scrollPattern.Current.HorizontalViewSize.Returns(data.ScrollPattern_HorizontalViewSize);
            scrollPattern.Current.VerticallyScrollable.Returns(data.ScrollPattern_VerticallyScrollable);
            scrollPattern.Current.VerticalScrollPercent.Returns(data.ScrollPattern_VerticalScrollPercent);
            scrollPattern.Current.VerticalViewSize.Returns(data.ScrollPattern_VerticalViewSize);

            scrollPattern.Cached.HorizontallyScrollable.Returns(data.ScrollPattern_HorizontallyScrollable);
            scrollPattern.Cached.HorizontalScrollPercent.Returns(data.ScrollPattern_HorizontalScrollPercent);
            scrollPattern.Cached.HorizontalViewSize.Returns(data.ScrollPattern_HorizontalViewSize);
            scrollPattern.Cached.VerticallyScrollable.Returns(data.ScrollPattern_VerticallyScrollable);
            scrollPattern.Cached.VerticalScrollPercent.Returns(data.ScrollPattern_VerticalScrollPercent);
            scrollPattern.Cached.VerticalViewSize.Returns(data.ScrollPattern_VerticalViewSize);

            return(scrollPattern);
        }
Beispiel #2
0
        public static IScrollItemPattern GetScrollItemPattern(PatternsData data)
        {
            IScrollItemPattern scrollItemPattern = Substitute.For <IScrollItemPattern>();

            // scrollItemPattern.ScrollIntoView().Received();
            return(scrollItemPattern);
        }
Beispiel #3
0
        public static IInvokePattern GetInvokePattern(PatternsData data)
        {
            IInvokePattern invokePattern = Substitute.For <IInvokePattern>();

            // invokePattern.Invoke
            return(invokePattern);
        }
Beispiel #4
0
        public static IExpandCollapsePattern GetExpandCollapsePattern(PatternsData data)
        {
            IExpandCollapsePattern expandCollapsePattern = Substitute.For <IExpandCollapsePattern>();

            expandCollapsePattern.Current.ExpandCollapseState.Returns(data.ExpandCollapsePattern_ExpandCollapseState);
            expandCollapsePattern.Cached.ExpandCollapseState.Returns(data.ExpandCollapsePattern_ExpandCollapseState);
            return(expandCollapsePattern);
        }
Beispiel #5
0
        public static IDockPattern GetDockPattern(PatternsData data)
        {
            var dockPattern = Substitute.For <IDockPattern>();

            dockPattern.SetDockPosition(Arg.Do <DockPosition>(pos => data.DockPattern_DockPosition = pos));
            dockPattern.Current.DockPosition.Returns(data.DockPattern_DockPosition);
            dockPattern.Cached.DockPosition.Returns(data.DockPattern_DockPosition);
            return(dockPattern);
        }
Beispiel #6
0
        public static ITogglePattern GetTogglePattern(PatternsData data)
        {
            ITogglePattern togglePattern = Substitute.For <ITogglePattern>();

            // togglePattern.Toggle().Received();
            // togglePattern.Toggle.SetDockPosition(Arg.Do<DockPosition>(pos => data.DockPattern_DockPosition = pos));
            togglePattern.Current.ToggleState.Returns(data.TogglePattern_ToggleState);
            return(togglePattern);
        }
Beispiel #7
0
        public static ITextPattern GetTextPattern(PatternsData data)
        {
            ITextPattern textPattern = Substitute.For <ITextPattern>();

            // textPattern.GetSelection
            // textPattern.GetVisibleRanges
            // textPattern.RangeFromChild
            // textPattern.RangeFromPoint
            textPattern.DocumentRange.Returns(data.TextPattern_DocumentRange);
            textPattern.SupportedTextSelection.Returns(data.TextPattern_SupportedTextSelection);
            return(textPattern);
        }
Beispiel #8
0
        public static IRangeValuePattern GetRangeValuePattern(PatternsData data)
        {
            IRangeValuePattern rangeValuePattern = Substitute.For <IRangeValuePattern>();

            rangeValuePattern.SetValue(Arg.Do <double>(arg => data.RangeValuePattern_Value = arg));
            rangeValuePattern.Current.IsReadOnly.Returns(data.RangeValuePattern_IsReadOnly);
            rangeValuePattern.Current.LargeChange.Returns(data.RangeValuePattern_LargeChange);
            rangeValuePattern.Current.Maximum.Returns(data.RangeValuePattern_Maximum);
            rangeValuePattern.Current.Minimum.Returns(data.RangeValuePattern_Minimum);
            rangeValuePattern.Current.SmallChange.Returns(data.RangeValuePattern_SmallChange);
            rangeValuePattern.Current.Value.Returns(data.RangeValuePattern_Value);
            return(rangeValuePattern);
        }
Beispiel #9
0
        public static ISelectionPattern GetSelectionPattern(PatternsData data)
        {
            ISelectionPattern selectionPattern = Substitute.For <ISelectionPattern>();

            //selectionPattern.Current.GetSelection()

            selectionPattern.Current.CanSelectMultiple.Returns(data.SelectionPattern_CanSelectMultiple);
            selectionPattern.Current.IsSelectionRequired.Returns(data.SelectionPattern_IsSelectionRequired);

            selectionPattern.Cached.CanSelectMultiple.Returns(data.SelectionPattern_CanSelectMultiple);
            selectionPattern.Cached.IsSelectionRequired.Returns(data.SelectionPattern_IsSelectionRequired);

            return(selectionPattern);
        }
Beispiel #10
0
        public static ITablePattern GetTablePattern(PatternsData data)
        {
            ITablePattern tablePattern = Substitute.For <ITablePattern>();

            tablePattern.Current.GetColumnHeaders().Returns(new IUiElement[] {});
            tablePattern.Current.GetRowHeaders().Returns(new IUiElement[] {});
            tablePattern.Current.ColumnCount.Returns(data.TablePattern_ColumnCount);
            tablePattern.Current.RowCount.Returns(data.TablePattern_RowCount);
            tablePattern.Current.RowOrColumnMajor.Returns(data.TablePattern_RowOrColumnMajor);
            tablePattern.Cached.ColumnCount.Returns(data.TablePattern_ColumnCount);
            tablePattern.Cached.RowCount.Returns(data.TablePattern_RowCount);
            tablePattern.Cached.RowOrColumnMajor.Returns(data.TablePattern_RowOrColumnMajor);
            return(tablePattern);
        }
Beispiel #11
0
        public static IGridItemPattern GetGridItemPattern(PatternsData data)
        {
            var gridItemPattern = Substitute.For <IGridItemPattern>();

            gridItemPattern.Current.Column.Returns(data.GridItemPattern_Column);
            gridItemPattern.Current.ColumnSpan.Returns(data.GridItemPattern_ColumnSpan);
            gridItemPattern.Current.ContainingGrid.Returns(data.GridItemPattern_ContainingGrid);
            gridItemPattern.Current.Row.Returns(data.GridItemPattern_Row);
            gridItemPattern.Current.RowSpan.Returns(data.GridItemPattern_RowSpan);
            gridItemPattern.Cached.Column.Returns(data.GridItemPattern_Column);
            gridItemPattern.Cached.ColumnSpan.Returns(data.GridItemPattern_ColumnSpan);
            gridItemPattern.Cached.ContainingGrid.Returns(data.GridItemPattern_ContainingGrid);
            gridItemPattern.Cached.Row.Returns(data.GridItemPattern_Row);
            gridItemPattern.Cached.RowSpan.Returns(data.GridItemPattern_RowSpan);
            return(gridItemPattern);
        }
Beispiel #12
0
        public static ISelectionItemPattern GetSelectionItemPattern(PatternsData data)
        {
            ISelectionItemPattern selectionItemPattern = Substitute.For <ISelectionItemPattern>();

            // selectionItemPattern.AddToSelection()
            // selectionItemPattern.RemoveFromSelection()
            // selectionItemPattern.Select()

            selectionItemPattern.Current.IsSelected.Returns(data.SelectionItemPattern_IsSelected);
            selectionItemPattern.Current.SelectionContainer.Returns(data.SelectionItemPattern_SelectionContainer);

            selectionItemPattern.Cached.IsSelected.Returns(data.SelectionItemPattern_IsSelected);
            selectionItemPattern.Cached.SelectionContainer.Returns(data.SelectionItemPattern_SelectionContainer);

            return(selectionItemPattern);
        }
Beispiel #13
0
        public static IWindowPattern GetWindowPattern(PatternsData data)
        {
            IWindowPattern windowPattern = Substitute.For <IWindowPattern>();

            // windowPattern.Close()
            windowPattern.SetWindowVisualState(Arg.Do <WindowVisualState>(state => data.WindowPattern_WindowVisualState = state));
            windowPattern.WaitForInputIdle(data.WindowPattern_Milliseconds);

            windowPattern.Current.CanMaximize.Returns(data.WindowPattern_CanMaximize);
            windowPattern.Current.CanMinimize.Returns(data.WindowPattern_CanMinimize);
            windowPattern.Current.IsModal.Returns(data.WindowPattern_IsModal);
            windowPattern.Current.IsTopmost.Returns(data.WindowPattern_IsTopmost);
            windowPattern.Current.WindowInteractionState.Returns(data.WindowPattern_WindowInteractionState);
            windowPattern.Current.WindowVisualState.Returns(data.WindowPattern_WindowVisualState);
            return(windowPattern);
        }
Beispiel #14
0
        public static IValuePattern GetValuePattern(PatternsData data)
        {
            IValuePattern valuePattern = Substitute.For <IValuePattern>();

            valuePattern.SetValue(Arg.Do <string>(arg => data.ValuePattern_Value = arg));
            IValuePatternInformation valuePatternInformation = Substitute.For <IValuePatternInformation>();

            valuePatternInformation.Value.Returns(data.ValuePattern_Value);
            valuePattern.Current.Returns(valuePatternInformation);
            // FakeSourcePattern sourcePattern = new FakeSourcePattern();
            var sourcePattern = new FakeSourcePattern();

            FakeSourcePattern.Pattern = ValuePattern.Pattern;
            valuePattern.SetSourcePattern(sourcePattern);
            return(valuePattern);
        }
Beispiel #15
0
        public static ITransformPattern GetTransformPattern(PatternsData data)
        {
            ITransformPattern transformPattern = Substitute.For <ITransformPattern>();

            // transformPattern.Move
            // transformPattern.Resize
            // transformPattern.Rotate
            // transformPattern.Move(Arg.Do<double>(x, y => transformPattern.GetParentElement().Current.BoundingRectangle.X.Returns(x); transformPattern.GetParentElement().Current.BoundingRectangle.Y.Returns(y)));
            transformPattern.Current.CanMove.Returns(data.TransformPattern_CanMove);
            transformPattern.Current.CanResize.Returns(data.TransformPattern_CanResize);
            transformPattern.Current.CanRotate.Returns(data.TransformPattern_CanRotate);
            transformPattern.Cached.CanMove.Returns(data.TransformPattern_CanMove);
            transformPattern.Cached.CanResize.Returns(data.TransformPattern_CanResize);
            transformPattern.Cached.CanRotate.Returns(data.TransformPattern_CanRotate);
            return(transformPattern);
        }
Beispiel #16
0
        public static ITableItemPattern GetTableItemPattern(PatternsData data)
        {
            ITableItemPattern tableItemPattern = Substitute.For <ITableItemPattern>();

            tableItemPattern.Current.GetColumnHeaderItems().Returns(new IUiElement[] {});
            tableItemPattern.Current.GetRowHeaderItems().Returns(new IUiElement[] {});
            tableItemPattern.Current.Column.Returns(data.TableItemPattern_Column);
            tableItemPattern.Current.ColumnSpan.Returns(data.TableItemPattern_ColumnSpan);
            tableItemPattern.Current.ContainingGrid.Returns(data.TableItemPattern_ContainingGrid);
            tableItemPattern.Current.Row.Returns(data.TableItemPattern_Row);
            tableItemPattern.Current.RowSpan.Returns(data.TableItemPattern_RowSpan);
            tableItemPattern.Cached.Column.Returns(data.TableItemPattern_Column);
            tableItemPattern.Cached.ColumnSpan.Returns(data.TableItemPattern_ColumnSpan);
            tableItemPattern.Cached.ContainingGrid.Returns(data.TableItemPattern_ContainingGrid);
            tableItemPattern.Cached.Row.Returns(data.TableItemPattern_Row);
            tableItemPattern.Cached.RowSpan.Returns(data.TableItemPattern_RowSpan);
            return(tableItemPattern);
        }
Beispiel #17
0
        public static IGridPattern GetGridPattern(PatternsData data)
        {
            var        gridPattern = Substitute.For <IGridPattern>();
            IUiElement fakeElement =
                GetAutomationElement(
                    data.GridPattern_GetItem_ControlType,
                    data.GridPattern_GetItem_Name,
                    data.GridPattern_GetItem_AutomationId,
                    data.GridPattern_GetItem_Class,
                    new IBasePattern[] {},
                    true);

            gridPattern.GetItem(Arg.Any <int>(), Arg.Any <int>()).Returns(fakeElement);
            gridPattern.Current.ColumnCount.Returns(data.GridPattern_ColumnCount);
            gridPattern.Current.RowCount.Returns(data.GridPattern_RowCount);
            gridPattern.Cached.ColumnCount.Returns(data.GridPattern_ColumnCount);
            gridPattern.Cached.RowCount.Returns(data.GridPattern_RowCount);
            return(gridPattern);
        }