using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using System.Threading;
namespace Systin.Library{
public sealed class SystinEngine
{
/// <summary>
/// Executes the instructions from the Test file on a given library. This method is the entry point into the Systin library and a mideium level of complexity.
/// <remarks>This method may need to be changed in the future to allow for configurable use of Watin language driver classes.</remarks>
/// </summary>
/// <param name="instructions">The instructions.</param>
/// <param name="driver">The driver.</param>
/// <returns><seealso cref="Stack<MethodInfo>"/>List of methods that have been executed</returns>
public static Stack<MethodInfo> ExecuteTestFile(Queue<Instruction> instructions, ref DllLoader driver)
{
//due to the STAThread problem with Watin I will create a new STAThread here and run LanguageDriverClassManager on it.
Thread newThread = new Thread(new ParameterizedThreadStart(LanguageDriverClassManager.CallMethodThreadedWrapper));
//Create a new languageDriverclass manager based on the input driver parm given
LanguageDriverClassManager ldcm = driver.LanguageDriverClassManager;
//create the new ThreadWorkerMethodCall object
ThreadWorkerMethodCall tworker = ThreadWorkerMethodCall.Factory(instructions, ref ldcm);
newThread.SetApartmentState(ApartmentState.STA);
newThread.Start(tworker);
newThread.Join();
return ldcm.InstructionStack;
}
}
}
|