[NUnit.Framework.Test] // [MbUnit.Framework.Test][NUnit.Framework.Test][Fact]
//        [Description("Checks that the basic elements' object model works, while the extended elements' object model is also on")]
        public void Toggle_Toggle_Off_ExtendedObjectModel_On()
        {
            // Arrange
            Preferences.UseElementsSearchObjectModel = true;

            var expectedValue = ToggleState.Off;
            var element       =
                FakeFactory.GetAutomationElementForMethodsOfObjectModel(
                    new IBasePattern[] { FakeFactory.GetTogglePattern(new PatternsData()) }) as ISupportsTogglePattern;

            // Act
            element.ToggleState.Returns(ToggleState.On);
            element.Toggle();
            try {
                (element as IUiElement).GetCurrentPattern <ITogglePattern>(TogglePattern.Pattern).Received().Toggle();
                if (ToggleState.On == element.ToggleState)
                {
                    element.ToggleState.Returns(ToggleState.Off);
                }
            }
            catch {}

            // Assert
            MbUnit.Framework.Assert.AreEqual(expectedValue, element.ToggleState);
            Assert.Equal(expectedValue, element.ToggleState);
        }
Пример #2
0
        [NUnit.Framework.Test] // [MbUnit.Framework.Test][NUnit.Framework.Test][Fact]
        public void Toggle_DoesNotImplementOtherPatterns()
        {
            var element =
                FakeFactory.GetAutomationElementForMethodsOfObjectModel(
                    new IBasePattern[] { FakeFactory.GetTogglePattern(new PatternsData()) }) as ISupportsValuePattern;

            MbUnit.Framework.Assert.IsNull(element as ISupportsValuePattern);
            Assert.Null(element as ISupportsValuePattern);
        }
Пример #3
0
        [NUnit.Framework.Test] // [MbUnit.Framework.Test][NUnit.Framework.Test][Fact]
        public void Toggle_ImplementsPatternInQuestion()
        {
            var element =
                FakeFactory.GetAutomationElementForMethodsOfObjectModel(
                    new IBasePattern[] { FakeFactory.GetTogglePattern(new PatternsData()) }) as ISupportsTogglePattern;

            MbUnit.Framework.Assert.IsNotNull(element as ISupportsTogglePattern);
            Assert.NotNull(element as ISupportsTogglePattern);
        }
Пример #4
0
        [NUnit.Framework.Test] // [MbUnit.Framework.Test][NUnit.Framework.Test][Fact]
        public void Toggle_ToggleState_On()
        {
            // Arrange
            var expectedValue = ToggleState.On;
            var element       =
                FakeFactory.GetAutomationElementForMethodsOfObjectModel(
                    new IBasePattern[] { FakeFactory.GetTogglePattern(new PatternsData()
                {
                    TogglePattern_ToggleState = expectedValue
                }) }) as ISupportsTogglePattern;

            // Act

            // Assert
            MbUnit.Framework.Assert.AreEqual(expectedValue, element.ToggleState);
            Assert.Equal(expectedValue, element.ToggleState);
        }
Пример #5
0
        [NUnit.Framework.Test] // [MbUnit.Framework.Test][NUnit.Framework.Test][Fact]
        public void Toggle_ImplementsCommonPattern()
        {
//            ISupportsInvokePattern invokableElement =
//                FakeFactory.GetAutomationElementForMethodsOfObjectModel(
//                    new IBasePattern[] { FakeFactory.GetTogglePattern(new PatternsData()) }) as ISupportsInvokePattern;
//
//            MbUnit.Framework.Assert.IsNotNull(invokableElement as ISupportsInvokePattern);

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

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

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

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

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

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

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

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