public void Constructor()
        {
            FindMethod findMethod = new FindMethod();

            Assert.AreEqual(FindMethodTypes.None, findMethod.MethodType, "Find method type not initialized correctly");
            Assert.IsNotNull(findMethod.Arguments, "Arguments not initialized correctly");
            Assert.AreEqual(0, findMethod.Arguments.Count, "Arguments not initialized correctly");
        }
예제 #2
0
        /// <summary>
        /// Parses input parameters to return a new instance of <see cref="FindMethod" />.
        /// <para>The list of supported find methods are as follows:
        /// <list methodType="table">
        /// 	<item>
        /// 		<term><see cref="FindMethodTypes.ById">ById</see></term>
        /// 		<description>
        ///             <para>Used to located an element by it's Id.</para>
        ///             <para><b>Required:</b> Id. Example: ById, new string[] {"btnOkay"}</para>
        ///         </description>
        /// 	</item>
        /// 	<item>
        /// 		<term><see cref="FindMethodTypes.ByLastElement">ByLastElement</see></term>
        /// 		<description>
        ///             <para>Use that last element found, from the previous command execution.</para>
        ///         </description>
        /// 	</item>
        /// 	<item>
        /// 		<term><see cref="FindMethodTypes.ByName">ByName</see></term>
        /// 		<description>
        ///             <para>Used to located an element by it's name.</para>
        ///             <para><b>Required arguments:</b> Name. Example: ByName, new string[] {"btnOkay"}</para>
        ///         </description>
        /// 	</item>
        /// 	<item>
        /// 		<term><see cref="FindMethodTypes.ByNameAndValue">ByNameAndValue</see></term>
        /// 		<description>
        ///             <para>Used to located an element by it's name and value, useful for locating radio buttons or checkboxes.</para>
        ///             <para><b>Required arguments:</b> Name and value. Example: ByNameAndValue, new string[] {"radio1", "2"} where 
        ///             radio1 is the element's name and 2 is it's value.
        ///             </para>
        ///         </description>
        /// 	</item>
        /// 	<item>
        /// 		<term><see cref="FindMethodTypes.ByTitle">ByTitle</see></term>
        /// 		<description>
        ///             <para>Used to located an element by it's title attribute.</para>
        ///             <para><b>Required arguments:</b> Title. Example: ByTitle, new string[] {"Click on this link"}</para>
        ///         </description>
        /// 	</item>
        /// 	<item>
        /// 		<term><see cref="FindMethodTypes.ByValue">ByValue</see></term>
        /// 		<description>
        ///             <para>Used to located an element by it's value.</para>
        ///             <para><b>Required arguments:</b> Value. Example: ByValue, new string[] {"visa"}</para>
        ///         </description>
        /// 	</item>
        /// </list>
        /// </para>
        /// </summary>
        /// <param name="findMethod">Partial string representation of a <see cref="FindMethodTypes" /></param>
        /// <param name="findMethodArgs">Arguments used by the find method to locate a <see cref="WatiN.Core.Element" />.</param>
        /// <returns>The find method for the specified method and arguments</returns>
        /// <exception cref="InvalidFindMethodException">If the find method is unknown or invalid.</exception>
        public static FindMethod Parse(string findMethod, string[] findMethodArgs)
        {
            if (string.IsNullOrEmpty(findMethod))
            {
                throw new ArgumentNullException("findMethod");
            }

            if (findMethodArgs == null)
            {
                throw new ArgumentNullException("findMethodArgs");
            }

            FindMethod returnValue = new FindMethod();
            returnValue.arguments = new Collection<string>(findMethodArgs);
            returnValue.methodType = ParseFindMethodType(findMethod);

            return returnValue;
        }
예제 #3
0
 /// <summary>
 /// Creates a new instance of <see cref="Command" />
 /// </summary>
 public Command()
 {
     this.findMethod = new FindMethod();
     this.id = string.Empty;
     this.arguments = new Collection<string>();
 }