Example #1
0
        public void NodeChecker_WhenGettingNodeWithContentDesc_ShouldReturnNode()
        {
            var foundNode = _nodeFinder.FindNode(_nodes, With.ContentDesc("Number_ListItem_Container"));

            Assert.IsNotNull(foundNode);
            Assert.AreEqual("Number_ListItem_Container", foundNode.ContentDesc);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CreateAttribute"/> class.
        /// </summary>
        /// <param name="with">Find node with this attribute tag.</param>
        /// <param name="value">Find node with this value on the wanted attribute tag.</param>
        public CreateAttribute(AttributeTags with, string value)
        {
            switch (with)
            {
            case AttributeTags.TextContains:
                With = With.ContainsText(value);
                break;

            case AttributeTags.Text:
                With = With.Text(value);
                break;

            case AttributeTags.ResourceId:
                With = With.ResourceId(value);
                break;

            case AttributeTags.ContentDesc:
                With = With.ContentDesc(value);
                break;

            case AttributeTags.Class:
                With = With.Class(value);
                break;

            case AttributeTags.Package:
                With = With.Package(value);
                break;

            case AttributeTags.Index:
                With = With.Index(int.Parse(value));
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(with), with, null);
            }
        }