public static IProject GetSilverlightProject(this RemoteTaskPacket sequence, IUnitTestRun run) { return(sequence.GetAllTasksRecursive() .Select(task => run.GetElementByRemoteTaskId(task.Task.Id)) .Where(element => element != null) .Select(element => element.GetProject()) .Where(project => project != null && project.PlatformID != null && project.PlatformID.Identifier == FrameworkIdentifier.Silverlight) .FirstOrDefault()); }
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; }
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; }