public void NoPatterns() { IFakeUiElement element = FakeFactory.GetAutomationElement( ControlType.Button, "name", "auId", "className", new IBasePattern[] {}, true); MbUnit.Framework.Assert.AreEqual(0, element.GetSupportedPatterns().Count()); Assert.Equal(0, element.GetSupportedPatterns().Count()); }
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()); }
private void TestParametersAgainstCollection( string containsText, string[] controlTypeNames, IEnumerable <IUiElement> collection, IEnumerable <int> handles, int expectedNumberOfElements) { // Act var resultList = RealCodeCaller.Win32Gateway_GetElements_WithControlSearcherDataInput( FakeFactory.GetAutomationElement(ControlType.Button, string.Empty, string.Empty, string.Empty, new IBasePattern[] {}, true), collection.ToArray(), handles, containsText); // Assert MbUnit.Framework.Assert.Count(expectedNumberOfElements, resultList); Assert.Equal(expectedNumberOfElements, resultList.Count); }
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()); }