Ejemplo n.º 1
0
        public void Selection_DoesNotImplementOtherPatterns()
        {
            var element =
                FakeFactory.GetAutomationElementForMethodsOfObjectModel(
                    new IBasePattern[] { FakeFactory.GetSelectionPattern(new PatternsData()) }) as ISupportsValuePattern;

            MbUnit.Framework.Assert.IsNull(element as ISupportsValuePattern);
            Assert.Null(element as ISupportsValuePattern);
        }
Ejemplo n.º 2
0
        public void Selection_ImplementsPatternInQuestion()
        {
            var element =
                FakeFactory.GetAutomationElementForMethodsOfObjectModel(
                    new IBasePattern[] { FakeFactory.GetSelectionPattern(new PatternsData()) }) as ISupportsSelectionPattern;

            MbUnit.Framework.Assert.IsNotNull(element as ISupportsSelectionPattern);
            Assert.NotNull(element as ISupportsSelectionPattern);
        }
Ejemplo n.º 3
0
        public void Selection_IsSelectionRequired()
        {
            // Arrange
            const bool expectedValue = false;
            var        element       =
                FakeFactory.GetAutomationElementForMethodsOfObjectModel(
                    new IBasePattern[] { FakeFactory.GetSelectionPattern(new PatternsData()
                {
                    SelectionPattern_IsSelectionRequired = expectedValue
                }) }) as ISupportsSelectionPattern;

            // Act

            // Assert
            MbUnit.Framework.Assert.AreEqual(expectedValue, element.IsSelectionRequired);
            Assert.Equal(expectedValue, element.IsSelectionRequired);
        }
Ejemplo n.º 4
0
        public void Selection_GetSelection()
        {
            // Arrange
            const bool expectedResult = true;
            bool       result         = false;
            var        element        =
                FakeFactory.GetAutomationElementForMethodsOfObjectModel(
                    new IBasePattern[] { FakeFactory.GetSelectionPattern(new PatternsData()) }) as ISupportsSelectionPattern;

            // Act
            element.GetSelection();
            try {
                var resultData = (element as IUiElement).GetCurrentPattern <ISelectionPattern>(SelectionPattern.Pattern).Current.Received(1).GetSelection();
                result = true;
            }
            catch {}

            // Assert
            MbUnit.Framework.Assert.AreEqual(expectedResult, result);
            Assert.Equal(expectedResult, result);
        }
Ejemplo n.º 5
0
        public void Selection_ImplementsCommonPattern()
        {
//            ISupportsInvokePattern invokableElement =
//                FakeFactory.GetAutomationElementForMethodsOfObjectModel(
//                    new IBasePattern[] { FakeFactory.GetSelectionPattern(new PatternsData()) }) as ISupportsInvokePattern;
//
//            MbUnit.Framework.Assert.IsNotNull(invokableElement as ISupportsInvokePattern);

            var highlightableElement =
                FakeFactory.GetAutomationElementForMethodsOfObjectModel(
                    new IBasePattern[] { FakeFactory.GetSelectionPattern(new PatternsData()) }) as ISupportsHighlighter;

            MbUnit.Framework.Assert.IsNotNull(highlightableElement as ISupportsHighlighter);
            Assert.NotNull(highlightableElement as ISupportsHighlighter);

            var navigatableElement =
                FakeFactory.GetAutomationElementForMethodsOfObjectModel(
                    new IBasePattern[] { FakeFactory.GetSelectionPattern(new PatternsData()) }) as ISupportsNavigation;

            MbUnit.Framework.Assert.IsNotNull(navigatableElement as ISupportsNavigation);
            Assert.NotNull(navigatableElement as ISupportsNavigation);

            var conversibleElement =
                FakeFactory.GetAutomationElementForMethodsOfObjectModel(
                    new IBasePattern[] { FakeFactory.GetSelectionPattern(new PatternsData()) }) as ISupportsConversion;

            MbUnit.Framework.Assert.IsNotNull(conversibleElement as ISupportsConversion);
            Assert.NotNull(conversibleElement as ISupportsConversion);

            var refreshableElement =
                FakeFactory.GetAutomationElementForMethodsOfObjectModel(
                    new IBasePattern[] { FakeFactory.GetSelectionPattern(new PatternsData()) }) as ISupportsRefresh;

            MbUnit.Framework.Assert.IsNotNull(refreshableElement as ISupportsRefresh);
            Assert.NotNull(refreshableElement as ISupportsRefresh);
        }