コード例 #1
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");
		}
コード例 #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
		private ApplicationContext MakeAppContext()
		{
			ApplicationContext ac = new ApplicationContext();
			ac.Run = "ok";
			//ac.GuiModel = "../../../GuiModels/TE.xml";
			ac.Path  = @"C:\fw\output\debug";
			ac.Exe   = "Harvest.exe";
			ac.Title = "Harvest";
			//string src = GetAttribute(xn, "source");
			//if (src != null) ac.SetSource(src, ts);
			ac.OnPass = "******";
			ac.OnFail = "assert";
			return ac;
		}
コード例 #4
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);
		}