Esempio n. 1
0
        [NUnit.Framework.Test] // [MbUnit.Framework.Test][NUnit.Framework.Test][Fact]
        public void Dock_ImplementsCommonPattern()
        {
//            ISupportsInvokePattern invokableElement =
//                FakeFactory.GetAutomationElementForMethodsOfObjectModel(
//                    new IBasePattern[] { FakeFactory.GetDockPattern(new PatternsData()) }) as ISupportsInvokePattern;
//
//            MbUnit.Framework.Assert.IsNotNull(invokableElement as ISupportsInvokePattern);

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

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

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

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

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

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

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

            MbUnit.Framework.Assert.IsNotNull(refreshableElement as ISupportsRefresh);
        }
Esempio n. 2
0
        public void Dock_DockPosition()
        {
            // Arrange
            DockPosition         expectedValue = DockPosition.Bottom;
            ISupportsDockPattern element       =
                FakeFactory.GetAutomationElementForMethodsOfObjectModel(
                    new IBasePattern[] { FakeFactory.GetDockPattern(new PatternsData()
                {
                    DockPattern_DockPosition = expectedValue
                }) }) as ISupportsDockPattern;

//            // Arrange
//            ExpandCollapseState expectedValue = ExpandCollapseState.Expanded;
//            ISupportsExpandCollapsePattern element =
//                FakeFactory.GetAutomationElementForMethodsOfObjectModel(
//                    new IBasePattern[] { FakeFactory.GetExpandCollapsePattern(new PatternsData() { ExpandCollapsePattern_ExpandCollapseState = expectedValue }) }) as ISupportsExpandCollapsePattern;


//            // Act
//            element.SetDockPosition(expectedValue);
//
//            // Assert
//            Assert.AreEqual(expectedValue, element.DockPosition);

            // Act
            // Assert
            CmdletUnitTest.TestRunspace.RunAndEvaluateAreEqual(
                @"$input | %{ $_.DockPosition; }",
                new [] { element },
                expectedValue.ToString());
        }
Esempio n. 3
0
 [NUnit.Framework.Test] // [MbUnit.Framework.Test][NUnit.Framework.Test][Fact]
 public void Current_On()
 {
     Preferences.UseElementsCurrent = true;
     var element =
         FakeFactory.GetAutomationElementForMethodsOfObjectModel(
             new IBasePattern[] { FakeFactory.GetDockPattern(new PatternsData()) }) as ISupportsCurrent;
     var testCurrent = element.Current;
 }
Esempio n. 4
0
        [NUnit.Framework.Test] // [MbUnit.Framework.Test][NUnit.Framework.Test][Fact]
        public void Dock_DoesNotImplementOtherPatterns()
        {
            var element =
                FakeFactory.GetAutomationElementForMethodsOfObjectModel(
                    new IBasePattern[] { FakeFactory.GetDockPattern(new PatternsData()) }) as ISupportsValuePattern;

            MbUnit.Framework.Assert.IsNull(element as ISupportsValuePattern);
            Xunit.Assert.Null(element as ISupportsValuePattern);
        }
Esempio n. 5
0
        [NUnit.Framework.Test] // [MbUnit.Framework.Test][NUnit.Framework.Test][Fact]
        public void Dock_ImplementsPatternInQuestion()
        {
            var element =
                FakeFactory.GetAutomationElementForMethodsOfObjectModel(
                    new IBasePattern[] { FakeFactory.GetDockPattern(new PatternsData()) }) as ISupportsDockPattern;

            MbUnit.Framework.Assert.IsNotNull(element as ISupportsDockPattern);
            Xunit.Assert.NotNull(element as ISupportsDockPattern);
        }
Esempio n. 6
0
        [NUnit.Framework.Test] // [MbUnit.Framework.Test][NUnit.Framework.Test][Fact]
        public void Current_Off()
        {
            Preferences.UseElementsCurrent = false;
            var element =
                FakeFactory.GetAutomationElementForMethodsOfObjectModel(
                    new IBasePattern[] { FakeFactory.GetDockPattern(new PatternsData()) }) as ISupportsCurrent;

            MbUnit.Framework.Assert.IsNull(element);
            Xunit.Assert.Null(element);
        }
Esempio n. 7
0
        [NUnit.Framework.Test] // [MbUnit.Framework.Test][NUnit.Framework.Test][Fact]
        public void Highlighter()
        {
            // Arrange
            // DockPosition expectedValue = DockPosition.Bottom;
            // 20140312
            // ISupportsHighlighter element =
            var element =
                FakeFactory.GetAutomationElementForMethodsOfObjectModel(
                    new IBasePattern[] { FakeFactory.GetDockPattern(new PatternsData()) }) as ISupportsHighlighter;

            // Act
            // element.SetDockPosition(expectedValue);
            element.Highlight();

            // Assert
            // Assert.AreEqual(expectedValue, element.DockPosition);
        }
Esempio n. 8
0
        [NUnit.Framework.Test] // [MbUnit.Framework.Test][NUnit.Framework.Test][Fact]
        public void Dock_DockPosition()
        {
            // Arrange
            const DockPosition expectedValue = DockPosition.Bottom;
            var element =
                FakeFactory.GetAutomationElementForMethodsOfObjectModel(
                    new IBasePattern[] { FakeFactory.GetDockPattern(new PatternsData()
                {
                    DockPattern_DockPosition = expectedValue
                }) }) as ISupportsDockPattern;

            // Act
            element.SetDockPosition(expectedValue);

            // Assert
            MbUnit.Framework.Assert.AreEqual(expectedValue, element.DockPosition);
            Xunit.Assert.Equal(expectedValue, element.DockPosition);
        }
        [NUnit.Framework.Test] // [MbUnit.Framework.Test][NUnit.Framework.Test][Fact]
//        [Description("Checks that there is no elements' object model available when the  parameter if $false")]
        public void DoenNotImplementCommonPatterns()
        {
            // Arrange
            Preferences.UseElementsPatternObjectModel = false;
            Preferences.UseElementsCached             = false;
            Preferences.UseElementsCurrent            = false;

            var invokableElement =
                FakeFactory.GetAutomationElementForMethodsOfObjectModel(
                    new IBasePattern[] { FakeFactory.GetDockPattern(new PatternsData()) }) as ISupportsInvokePattern;

            MbUnit.Framework.Assert.IsNull(invokableElement as ISupportsInvokePattern);
            Assert.Null(invokableElement as ISupportsInvokePattern);

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

            MbUnit.Framework.Assert.IsNull(highlightableElement as ISupportsHighlighter);
            Assert.Null(highlightableElement as ISupportsHighlighter);

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

            MbUnit.Framework.Assert.IsNull(navigatableElement as ISupportsNavigation);
            Assert.Null(navigatableElement as ISupportsNavigation);

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

            MbUnit.Framework.Assert.IsNull(conversibleElement as ISupportsConversion);
            Assert.Null(conversibleElement as ISupportsConversion);

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

            MbUnit.Framework.Assert.IsNull(refreshableElement as ISupportsRefresh);
            Assert.Null(refreshableElement as ISupportsRefresh);
        }
Esempio n. 10
0
        [NUnit.Framework.Test] // [MbUnit.Framework.Test][NUnit.Framework.Test][Fact]
        public void Dock_SetDockPosition()
        {
            // Arrange
            const DockPosition expectedValue = DockPosition.Left;
            var element =
                FakeFactory.GetAutomationElementForMethodsOfObjectModel(
                    new IBasePattern[] { FakeFactory.GetDockPattern(new PatternsData()) }) as ISupportsDockPattern;

            // Act
            element.SetDockPosition(expectedValue);
            try {
                (element as IUiElement).GetCurrentPattern <IDockPattern>(DockPattern.Pattern).Received(1).SetDockPosition(expectedValue);
                element.DockPosition.Returns(expectedValue);
            }
            catch {}

            // Assert
            MbUnit.Framework.Assert.AreEqual(expectedValue, element.DockPosition);
            Xunit.Assert.Equal(expectedValue, element.DockPosition);
        }
Esempio n. 11
0
        [NUnit.Framework.Test] // [MbUnit.Framework.Test][NUnit.Framework.Test][Fact]
        public void Navigation()
        {
            // Arrange
            // DockPosition expectedValue = DockPosition.Bottom;
            // 20140312
            // ISupportsNavigation element =
            var element =
                FakeFactory.GetAutomationElementForMethodsOfObjectModel(
                    new IBasePattern[] { FakeFactory.GetDockPattern(new PatternsData()) }) as ISupportsNavigation;

            // Act
            // element.SetDockPosition(expectedValue);
            element.NavigateToFirstChild();
            element.NavigateToLastChild();
            element.NavigateToPreviousSibling();
            element.NavigateToNextSibling();
            element.NavigateToParent();

            // Assert
            // Assert.AreEqual(expectedValue, element.DockPosition);
        }