public void NodeChecker_WhenGettingNodeWithLamba_ShouldReturnNode() { var foundNode = _nodeFinder.FindNode(_nodes, With.Lambda(node => node.Text == "Buss" && node.Class == "android.widget.TextView" && node.Parent.Class == "android.support.v7.app.ActionBar$Tab")); Assert.IsNotNull(foundNode); }
public void FindNodes_WhenLookingForNode_ShouldCallOnCorrectServices() { With.Lambda(n => n.Text == "Some text" && n.Parent != null && n.Children.First().ContentDesc == "My child"); var document = new XDocument(); var nodes = new List <Node>(); var with = new[] { With.Text("mm") }; _screenDumper.Setup(s => s.DumpUi()).Returns(document); _nodeParser.Setup(n => n.ParseNodes(document)).Returns(nodes); _nodeFinder.Setup(n => n.FindNodes(nodes, with)).Returns(new List <Node> { new Node(new XElement("node"), null) }); _uiComponent.FindNode(0, with); _screenDumper.Verify(s => s.DumpUi(), Times.Once); _nodeParser.Verify(n => n.ParseNodes(document), Times.Once); _nodeFinder.Verify(n => n.FindNodes(nodes, with), Times.Once); }
public void NodeChecker_WhenGettingMultipleNodes_ShouldReturnAllMatchingNodes() { var nodes = _nodeFinder.FindNodes(_nodes, With.Lambda(n => n.ContentDesc == "Number_ListItem")); Assert.AreEqual(2, nodes.Count); }