Пример #1
0
        public void OnePattern()
        {
            IFakeUiElement element =
                FakeFactory.GetAutomationElement(
                    ControlType.Button,
                    "name",
                    "auId",
                    "className",
                    new[] { AutomationFactory.GetPatternAdapter <IValuePattern>(AutomationFactory.GetUiElement(), null) },
                    true);

            MbUnit.Framework.Assert.AreEqual(1, element.GetSupportedPatterns().Count());
            MbUnit.Framework.Assert.Exists(element.GetSupportedPatterns(), p => p is IValuePattern);
            Assert.Equal(1, element.GetSupportedPatterns().Count());
            // Xunit.Assert.Contains<IBasePattern>(AutomationFactory.GetPatternAdapter<IValuePattern>(AutomationFactory.GetUiElement(), null) as IBasePattern, element.GetSupportedPatterns());
        }
Пример #2
0
        public void ThreePatterns()
        {
            IFakeUiElement element =
                FakeFactory.GetAutomationElement(
                    ControlType.Button,
                    "name",
                    "auId",
                    "className",
                    new IBasePattern[] {
                AutomationFactory.GetPatternAdapter <IExpandCollapsePattern>(AutomationFactory.GetUiElement(), null),
                AutomationFactory.GetPatternAdapter <ITableItemPattern>(AutomationFactory.GetUiElement(), null),
                AutomationFactory.GetPatternAdapter <IWindowPattern>(AutomationFactory.GetUiElement(), null)
            },
                    true);

            MbUnit.Framework.Assert.AreEqual(3, element.GetSupportedPatterns().Count());
            MbUnit.Framework.Assert.Exists(element.GetSupportedPatterns(), p => p is IExpandCollapsePattern);
            MbUnit.Framework.Assert.Exists(element.GetSupportedPatterns(), p => p is ITableItemPattern);
            MbUnit.Framework.Assert.Exists(element.GetSupportedPatterns(), p => p is IWindowPattern);
            Assert.Equal(3, element.GetSupportedPatterns().Count());
            // Xunit.Assert.Contains<IBasePattern>(AutomationFactory.GetPatternAdapter<IExpandCollapsePattern>(AutomationFactory.GetUiElement(), null) as IBasePattern, element.GetSupportedPatterns());
            // Xunit.Assert.Contains<IBasePattern>(AutomationFactory.GetPatternAdapter<ITableItemPattern>(AutomationFactory.GetUiElement(), null), element.GetSupportedPatterns());
            // Xunit.Assert.Contains<IBasePattern>(AutomationFactory.GetPatternAdapter<IWindowPattern>(AutomationFactory.GetUiElement(), null), element.GetSupportedPatterns());
        }
Пример #3
0
 public override N GetCurrentPattern <N>(AutomationPattern pattern)
 {
     return(AutomationFactory.GetPatternAdapter <N>(null));
 }