예제 #1
0
        public void PassFailContext(string PassIn, string FailIn, out string onPass, out string onFail)
        {
            // Set up a typical instruction tree.
            TestState ts   = TestState.getOnly("LT");
            NoOp      op1  = new NoOp();
            NoOp      op2  = new NoOp();
            NoOp      op3  = new NoOp();
            Desktop   Desk = new Desktop();

            Desk.Add(op1);
            op1.Parent = Desk;
            Desk.Add(op2);
            op2.Parent = Desk;
            Desk.Add(op3);
            op3.Parent = Desk;
            ApplicationContext ac = MakeAppContext();

            ts.AddNamedInstruction("Find me", ac);
            ApplicationContext AppCon = new ApplicationContext();

            AppCon.SetSource("Find me");
            Assert.AreEqual(ac, (ApplicationContext)AppCon.TestGetOfSource(), "Context source not set right");
            Desk.Add(AppCon);
            NoOp ins1 = new NoOp();
            NoOp ins2 = new NoOp();
            NoOp ins3 = new NoOp();

            AppCon.Add(ins1);
            ins1.Parent = AppCon;
            AppCon.Add(ins2);
            ins2.Parent = AppCon;
            AppCon.Add(ins3);
            ins3.Parent = AppCon;
            ins2.PassFailInContext(PassIn, FailIn, out onPass, out onFail);
        }
예제 #2
0
        /// <summary>
        /// Creates an application context instruction.
        /// </summary>
        /// <param name="xn">The XML repersentation of the instruction to be checked</param>
        /// <param name="con">The current context object</param>
        static ApplicationContext CreateApplicationContext(XmlNode xn, Context con)
        {
            ApplicationContext ac = new ApplicationContext();

            ac.Run = XmlFiler.getAttribute(xn, "run");
            if (ac.Run == null || ac.Run == "")
            {
                ac.Run = "ok";
            }
            ac.Gui   = XmlFiler.getAttribute(xn, "gui");
            ac.Path  = XmlFiler.getAttribute(xn, "path");
            ac.Exe   = XmlFiler.getAttribute(xn, "exe");
            ac.Args  = XmlFiler.getAttribute(xn, "args");
            ac.Work  = XmlFiler.getAttribute(xn, "work");
            ac.Title = XmlFiler.getAttribute(xn, "title");
            string src = XmlFiler.getAttribute(xn, "source");

            if (src != null)
            {
                ac.SetSource(src);
            }
            ac.Close  = XmlFiler.getAttribute(xn, "close");
            ac.OnPass = XmlFiler.getAttribute(xn, "on-pass");
            ac.OnFail = XmlFiler.getAttribute(xn, "on-fail");
            string rest = XmlFiler.getAttribute(xn, "wait");

            if (rest != null)
            {
                ac.Rest = Convert.ToInt32(rest);
            }
            ac.Configure();             // set model root for use by children
            ac.ModelNode = con.ModelNode;
            AddInstruction(xn, ac, con);
            return(ac);
        }
예제 #3
0
		public void CreateAppContextFromSource()
		{
			TestState ts = TestState.getOnly("LT");
			ApplicationContext ac = MakeAppContext();
			ts.AddNamedInstruction("Find me",ac);
			ApplicationContext ac2 = new ApplicationContext();
			ac2.SetSource("Find me");
			Assert.AreEqual(ac,(ApplicationContext)ac2.TestGetOfSource(),"Context source not set right");
		}
예제 #4
0
        public void CreateAppContextFromSource()
        {
            TestState          ts = TestState.getOnly("LT");
            ApplicationContext ac = MakeAppContext();

            ts.AddNamedInstruction("Find me", ac);
            ApplicationContext ac2 = new ApplicationContext();

            ac2.SetSource("Find me");
            Assert.AreEqual(ac, (ApplicationContext)ac2.TestGetOfSource(), "Context source not set right");
        }
예제 #5
0
		/// <summary>
		/// Creates an application context instruction.
		/// </summary>
		/// <param name="xn">The XML repersentation of the instruction to be checked</param>
		/// <param name="con">The current context object</param>
		static ApplicationContext CreateApplicationContext(XmlNode xn, Context con)
		{
			ApplicationContext ac = new ApplicationContext();
			ac.Run = XmlFiler.getAttribute(xn, "run");
			if (ac.Run == null || ac.Run == "") ac.Run = "ok";
			ac.Gui   = XmlFiler.getAttribute(xn, "gui");
			ac.Path  = XmlFiler.getAttribute(xn, "path");
			ac.Exe   = XmlFiler.getAttribute(xn, "exe");
			ac.Args  = XmlFiler.getAttribute(xn, "args");
			ac.Work  = XmlFiler.getAttribute(xn, "work");
			ac.Title = XmlFiler.getAttribute(xn, "title");
			string src = XmlFiler.getAttribute(xn, "source");
			if (src != null) ac.SetSource(src);
			ac.Close  = XmlFiler.getAttribute(xn, "close");
			ac.OnPass = XmlFiler.getAttribute(xn, "on-pass");
			ac.OnFail = XmlFiler.getAttribute(xn, "on-fail");
			string rest = XmlFiler.getAttribute(xn, "wait");
			if (rest != null) ac.Rest = Convert.ToInt32(rest);
			ac.Configure(); // set model root for use by children
			ac.ModelNode = con.ModelNode;
			AddInstruction(xn, ac, con);
			return ac;
		}
예제 #6
0
		public void PassFailAncestorContext(string PassIn, string FailIn, out string onPass, out string onFail)
		{
			// Set up a typical instruction tree.
			TestState ts = TestState.getOnly("LT");
			ts.Script = "ApplicationContextTest.xml";
			NoOp op1 = new NoOp();
			NoOp op2 = new NoOp();
			NoOp op3 = new NoOp();
			Desktop Desk = new Desktop();
			Desk.OnPass = PassIn;
			Desk.OnFail = FailIn;
			Desk.Add(op1);
			op1.Parent = Desk;
			Desk.Add(op2);
			op2.Parent = Desk;
			Desk.Add(op3);
			op3.Parent = Desk;
			ApplicationContext ac = MakeAppContext();
			ts.AddNamedInstruction("Find me",ac);
			ApplicationContext AppCon = new ApplicationContext();
			AppCon.SetSource("Find me");
			Assert.AreEqual(ac,(ApplicationContext)AppCon.TestGetOfSource(),"Context source not set right");
			Desk.Add(AppCon);
			AppCon.Parent = Desk;
			NoOp ins1 = new NoOp();
			NoOp ins2 = new NoOp();
			NoOp ins3 = new NoOp();
			AppCon.Add(ins1);
			ins1.Parent = AppCon;
			AppCon.Add(ins2);
			ins2.Parent = AppCon;
			AppCon.Add(ins3);
			ins3.Parent = AppCon;
			ins2.PassFailInContext(null,null,out onPass,out onFail);
		}