private string GetNodeValue(Node node, AttributeTags with) { switch (with) { case AttributeTags.Text: return(node.Text); case AttributeTags.ResourceId: return(node.ResourceId); case AttributeTags.ContentDesc: return(node.ContentDesc); case AttributeTags.Class: return(node.Class); case AttributeTags.Package: return(node.Package); case AttributeTags.Index: return(node.Index); default: throw new ArgumentOutOfRangeException(nameof(with), with, null); } }
private static With Attribute(AttributeTags attribute, string value) { switch (attribute) { case AttributeTags.TextContains: return(new With(node => node.Text.Contains(value), $"text contains \"{value}\"")); case AttributeTags.Text: return(new With(node => node.Text == value, $"text equals \"{value}\"")); case AttributeTags.ResourceId: return(new With(node => node.ResourceId == value, $"resource id equals \"{value}\"")); case AttributeTags.ContentDesc: return(new With(node => node.ContentDesc == value, $"content desc equals \"{value}\"")); case AttributeTags.Class: return(new With(node => node.Class == value, $"class equals \"{value}\"")); case AttributeTags.Index: return(new With(node => node.Index == value, $"index equals {value}")); case AttributeTags.Package: return(new With(node => node.Package == value, $"package equals \"{value}\"")); default: throw new ArgumentOutOfRangeException(nameof(attribute), attribute, null); } }
private void RemoveWith(AttributeTags tag) { if (tag == AttributeTags.TextContains) { return; } UsedWiths.Remove(tag); NotUsedWiths.Add(tag); }
private void CheckWith(string value, AttributeTags tag) { if (UiObjectInfo.FindWith.Contains(tag)) { UsedWiths.Add(tag); } else { if (string.IsNullOrEmpty(value)) { return; } NotUsedWiths.Add(tag); } }
/// <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); } }