Ejemplo n.º 1
0
        /// <summary>
        /// Creates a new instance of the ApplicationMonitorConfig
        /// </summary>
        /// <param name="filename">filename of the config file to parse</param>
        public ApplicationMonitorConfig(string filename)
        {
            XmlDocument doc = new XmlDocument();

            doc.Load(filename);

            //default usings...
            usings.Add(new UsingStatement(typeof(ApplicationMonitor).Assembly, "Microsoft.Test.Loaders.Steps"));
            usings.Add(new UsingStatement(typeof(ApplicationMonitor).Assembly, "Microsoft.Test.Loaders.UIHandlers"));

            #pragma warning disable 618
            //Get the using statements
            // LoadWithPartialName should be OK here since the only assemblies that I can find in Usings for AMC files
            // are test assemblies (Which will therefore match CLR version)
            foreach (XmlElement usingElement in doc.DocumentElement.SelectNodes("Using"))
            {
                usings.Add(new UsingStatement(Assembly.LoadWithPartialName(usingElement.GetAttribute("Assembly")), usingElement.GetAttribute("Namespace")));
            }
            #pragma warning restore 618

            //Create all the steps
            foreach (XmlElement stepElement in doc.DocumentElement.SelectNodes("Steps/*"))
            {
                LoaderStep step = ParseObject(stepElement) as LoaderStep;
                if (step == null)
                {
                    throw new ArgumentException("The Steps element may only contain objects of Type LoaderStep");
                }
                mainStep.AddChildStep(step);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Adds a Step as a Child to this Step.
 /// </summary>
 /// <param name="step">the step to add to as a child</param>
 /// <remarks>
 /// Child Steps are invoked when the Step in implemented asynchronously using BeginStep and EndStep
 /// </remarks>
 public void AddChildStep(LoaderStep step)
 {
     step.parentStep = this;
     childSteps.Add(step);
 }