public RemoteTask GetTheoryTask(string name, string type, string method) { if (!IsTheory(name, type, method)) { return(null); } var methodTask = (XunitTestMethodTask)GetMethodTask(name, type, method); if (!theoryTasks.ContainsKey(methodTask)) { theoryTasks.Add(methodTask, new List <XunitTestTheoryTask>()); } var shortName = GetTheoryShortName(name, type); var theoryTask = theoryTasks[methodTask].FirstOrDefault(t => t.TheoryName == shortName); if (theoryTask == null) { theoryTask = new XunitTestTheoryTask(methodTask.AssemblyLocation, methodTask.TypeName, methodTask.MethodName, shortName); theoryTasks[methodTask].Add(theoryTask); server.CreateDynamicElement(theoryTask); } return(theoryTask); }
private void AddTheory(XunitTestMethodTask methodTask, XunitTestTheoryTask theoryTask) { if (!theoryTasks.ContainsKey(methodTask)) { theoryTasks.Add(methodTask, new List <XunitTestTheoryTask>()); } theoryTasks[methodTask].Add(theoryTask); }
private RemoteTaskWrapper CreateDynamicTheoryTask(ITestMethod testMethod, string theoryName) { var methodTask = GetMethodTask(testMethod, testMethod.Method.Name); var theoryTask = new XunitTestTheoryTask((XunitTestMethodTask)methodTask.RemoteTask, DisplayNameUtil.Escape(theoryName)); var task = new RemoteTaskWrapper(theoryTask, server); server.CreateDynamicElement(theoryTask); return(task); }
public void Add(XunitTestTheoryTask theoryTask) { // TheoryName is the display name with any type prefix stripped off // TODO: Why strip off the type prefix? It's not used anywhere var fullyQualifiedMethodName = string.Format("{0}.{1}", theoryTask.TypeName, theoryTask.MethodName); var key = string.Format("{0}-{1}", fullyQualifiedMethodName, theoryTask.TheoryName); lock (lockObject) { // TODO: Does this handle repeated tasks? if (!tasksByTheoryId.ContainsKey(key)) { AddTheoryTask(key, fullyQualifiedMethodName, new RemoteTaskWrapper(theoryTask, server)); } } }