예제 #1
0
        public void NodeChecker_WhenGettingNodeWithIndex_ShouldReturnNode()
        {
            var foundNode = _nodeFinder.FindNode(_nodes, With.Index(1));

            Assert.IsNotNull(foundNode);
            Assert.AreEqual("1", foundNode.Index);
        }
        /// <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);
            }
        }
 public void Constructor_WhenCreatingExceptionWithThreeWiths_ShouldGetCorrectErrorMessage()
 {
     Assert.AreEqual("Could not find node where resource id equals \"test\", package equals \"myPackage\" and index equals 2", new UiNodeNotFoundException(new List <With> {
         With.ResourceId("test"), With.Package("myPackage"), With.Index(2)
     }).Message);
 }