public static void EnsureSilverlightPlatformSupport(this IUnitTestLaunch launch, ref IUnitTestRun run, IUnitTestProvider provider, ITaskRunnerHostController hostController) { foreach (var sequence in run.GetRootTasks().ToArray()) { ConvertToSilverlightSequenceIfNecessary(sequence, ref run, launch, provider, hostController); } }
public static void AddTaskSequence(this IUnitTestRun run, RemoteTaskPacket sequence, SilverlightUnitTestElement silverlightElement, IUnitTestRun originalRun) { var runTasks = run.GetField <Dictionary <RemoteTask, IUnitTestElement> >("myTasks"); var runTaskIdsToElements = run.GetField <Dictionary <string, IUnitTestElement> >("myTaskIdsToElements"); var runElementsToTasks = run.GetField <Dictionary <IUnitTestElement, RemoteTask> >("myElementsToTasks"); if (runTasks == null) { runTasks = new Dictionary <RemoteTask, IUnitTestElement>(); run.SetField("myTasks", runTasks); } if (runTaskIdsToElements == null) { runTaskIdsToElements = new Dictionary <string, IUnitTestElement>(); run.SetField("myTaskIdsToElements", runTaskIdsToElements); } if (runElementsToTasks == null) { runElementsToTasks = new Dictionary <IUnitTestElement, RemoteTask>(); run.SetField("myElementsToTasks", runElementsToTasks); } foreach (var unitTestTask in sequence.GetAllTasksRecursive()) { var element = originalRun.GetElementByRemoteTaskId(unitTestTask.Task.Id); runTasks[unitTestTask.Task] = element; if (element != null) { runTaskIdsToElements[unitTestTask.Task.Id] = element; runElementsToTasks[element] = unitTestTask.Task; } } run.GetRootTasks().Add(sequence); runTasks[sequence.Task] = silverlightElement; runTaskIdsToElements[sequence.Task.Id] = silverlightElement; runElementsToTasks[silverlightElement] = sequence.Task; }
private static void ConvertToSilverlightSequenceIfNecessary(RemoteTaskPacket sequence, IUnitTestRun run, IUnitTestLaunch launch, UnitTestProviders providers, ITaskRunnerHostController hostController) { if (!sequence.IsSilverlightSequence()) { var silverlightProject = sequence.GetSilverlightProject(run); if (silverlightProject != null) { var silverlightRun = launch.GetOrCreateSilverlightRun(silverlightProject.PlatformID, providers, hostController); var provider = providers.GetProvider(SilverlightUnitTestProvider.RunnerId); var silverlightElement = new SilverlightUnitTestElement(provider, silverlightRun.Key.RunStrategy); var remoteTask = new SilverlightUnitTestTask(silverlightProject.PlatformID.Version, silverlightProject.GetXapPath(), silverlightProject.GetDllPath()); var silverlightSequence = new RemoteTaskPacket(remoteTask) { TaskPackets = { sequence } }; run.GetRootTasks().Remove(sequence); silverlightRun.Value.AddTaskSequence(silverlightSequence, silverlightElement, run); } } }
private static void ConvertToSilverlightSequenceIfNecessary(RemoteTaskPacket sequence, ref IUnitTestRun run, IUnitTestLaunch launch, IUnitTestProvider provider, ITaskRunnerHostController hostController) { if (!sequence.IsSilverlightSequence()) { var silverlightProject = sequence.GetSilverlightProject(run); if (silverlightProject != null) { var silverlightRun = launch.GetOrCreateSilverlightRun(silverlightProject.PlatformID, provider, hostController); var silverlightElement = new SilverlightUnitTestElement(new UnitTestElementId(provider, run.Elements.First().Id.PersistentProjectId, Guid.NewGuid().ToString()), silverlightRun.Key.RunStrategy); var remoteTask = new SilverlightUnitTestTask(silverlightProject.PlatformID.Version, silverlightProject.GetXapPath(), silverlightProject.GetDllPath()); var silverlightSequence = new RemoteTaskPacket(remoteTask) { TaskPackets = { sequence } }; run.GetRootTasks().Remove(sequence); silverlightRun.Value.AddTaskSequence(silverlightSequence, silverlightElement, run); run = silverlightRun.Value; } } }
public static Version GetSilverlightPlatformVersion(this IUnitTestRun run) { var sequence = run.GetRootTasks().FirstOrDefault(); return(sequence != null?sequence.GetSilverlightPlatformVersion() : null); }