public void SelectionItem_DoesNotImplementOtherPatterns() { var element = FakeFactory.GetAutomationElementForMethodsOfObjectModel( new IBasePattern[] { FakeFactory.GetSelectionItemPattern(new PatternsData()) }) as ISupportsValuePattern; MbUnit.Framework.Assert.IsNull(element as ISupportsValuePattern); Assert.Null(element as ISupportsValuePattern); }
public void SelectionItem_SelectionContainer() { // Arrange var expectedValue = new UiElement(); var element = FakeFactory.GetAutomationElementForMethodsOfObjectModel( new IBasePattern[] { FakeFactory.GetSelectionItemPattern(new PatternsData() { SelectionItemPattern_SelectionContainer = expectedValue }) }) as ISupportsSelectionItemPattern; // Act // Assert MbUnit.Framework.Assert.AreEqual(expectedValue, element.SelectionContainer); Assert.Equal(expectedValue, element.SelectionContainer); }
public void SelectionItem_IsSelected() { // Arrange const bool expectedValue = true; var element = FakeFactory.GetAutomationElementForMethodsOfObjectModel( new IBasePattern[] { FakeFactory.GetSelectionItemPattern(new PatternsData() { SelectionItemPattern_IsSelected = expectedValue }) }) as ISupportsSelectionItemPattern; // Act // Assert MbUnit.Framework.Assert.AreEqual(expectedValue, element.IsSelected); Assert.Equal(expectedValue, element.IsSelected); }
public void SelectionItem_AddToSelection() { // Arrange const bool expectedResult = true; bool result = false; var element = FakeFactory.GetAutomationElementForMethodsOfObjectModel( new IBasePattern[] { FakeFactory.GetSelectionItemPattern(new PatternsData()) }) as ISupportsSelectionItemPattern; // Act element.AddToSelection(); try { (element as IUiElement).GetCurrentPattern <ISelectionItemPattern>(SelectionItemPattern.Pattern).Received(1).AddToSelection(); result = true; } catch {} // Assert MbUnit.Framework.Assert.AreEqual(expectedResult, result); Assert.Equal(expectedResult, result); }
public void SelectionItem_ImplementsCommonPattern() { // ISupportsInvokePattern invokableElement = // FakeFactory.GetAutomationElementForMethodsOfObjectModel( // new IBasePattern[] { FakeFactory.GetSelectionItemPattern(new PatternsData()) }) as ISupportsInvokePattern; // // MbUnit.Framework.Assert.IsNotNull(invokableElement as ISupportsInvokePattern); var highlightableElement = FakeFactory.GetAutomationElementForMethodsOfObjectModel( new IBasePattern[] { FakeFactory.GetSelectionItemPattern(new PatternsData()) }) as ISupportsHighlighter; MbUnit.Framework.Assert.IsNotNull(highlightableElement as ISupportsHighlighter); Assert.NotNull(highlightableElement as ISupportsHighlighter); var navigatableElement = FakeFactory.GetAutomationElementForMethodsOfObjectModel( new IBasePattern[] { FakeFactory.GetSelectionItemPattern(new PatternsData()) }) as ISupportsNavigation; MbUnit.Framework.Assert.IsNotNull(navigatableElement as ISupportsNavigation); Assert.NotNull(navigatableElement as ISupportsNavigation); var conversibleElement = FakeFactory.GetAutomationElementForMethodsOfObjectModel( new IBasePattern[] { FakeFactory.GetSelectionItemPattern(new PatternsData()) }) as ISupportsConversion; MbUnit.Framework.Assert.IsNotNull(conversibleElement as ISupportsConversion); Assert.NotNull(conversibleElement as ISupportsConversion); var refreshableElement = FakeFactory.GetAutomationElementForMethodsOfObjectModel( new IBasePattern[] { FakeFactory.GetSelectionItemPattern(new PatternsData()) }) as ISupportsRefresh; MbUnit.Framework.Assert.IsNotNull(refreshableElement as ISupportsRefresh); Assert.NotNull(refreshableElement as ISupportsRefresh); }