コード例 #1
0
        /// <summary>
        /// Creates a glimpse instruction and parses its content.
        /// </summary>
        /// <param name="xn">The XML repersentation of the instruction to be checked</param>
        /// <param name="con">The current context object</param>
        static Glimpse CreateGlimpse(XmlNode xn, Context con)
        {
            Glimpse glimpse = new Glimpse();

            glimpse.Path   = XmlFiler.getAttribute(xn, "path");
            glimpse.Select = XmlFiler.getAttribute(xn, "select");
            Logger.getOnly().isTrue(glimpse.Path != null || glimpse.Select != null, "Glimpse instruction must have a path or select.");
            Logger.getOnly().isTrue(glimpse.Path != "" || glimpse.Select != "", "Glimpse instruction must have a non-empty path or select.");
            glimpse.Prop   = XmlFiler.getAttribute(xn, "prop");
            glimpse.Expect = XmlFiler.getAttribute(xn, "expect");
            glimpse.OnPass = XmlFiler.getAttribute(xn, "on-pass");
            glimpse.OnFail = XmlFiler.getAttribute(xn, "on-fail");
            string rest = XmlFiler.getAttribute(xn, "wait");

            if (rest != null)
            {
                glimpse.Rest = Convert.ToInt32(rest);
            }
            InterpretMessage(glimpse, xn.ChildNodes);
            AddInstruction(xn, glimpse, con);
            return(glimpse);
        }
コード例 #2
0
		/// <summary>
		/// Creates a glimpse instruction and parses its content.
		/// </summary>
		/// <param name="xn">The XML repersentation of the instruction to be checked</param>
		/// <param name="con">The current context object</param>
		static Glimpse CreateGlimpse(XmlNode xn, Context con)
		{
			Glimpse glimpse = new Glimpse();
			glimpse.Path   = XmlFiler.getAttribute(xn, "path");
			glimpse.Select = XmlFiler.getAttribute(xn, "select");
			Logger.getOnly().isTrue(glimpse.Path != null || glimpse.Select != null, "Glimpse instruction must have a path or select.");
			Logger.getOnly().isTrue(glimpse.Path != "" || glimpse.Select != "", "Glimpse instruction must have a non-empty path or select.");
			glimpse.Prop   = XmlFiler.getAttribute(xn, "prop");
			glimpse.Expect = XmlFiler.getAttribute(xn, "expect");
			glimpse.OnPass = XmlFiler.getAttribute(xn, "on-pass");
			glimpse.OnFail = XmlFiler.getAttribute(xn, "on-fail");
			string rest = XmlFiler.getAttribute(xn, "wait");
			if (rest != null) glimpse.Rest = Convert.ToInt32(rest);
			InterpretMessage(glimpse, xn.ChildNodes);
			AddInstruction(xn, glimpse, con);
			return glimpse;
		}