Permalink
Browse files

Preparing ReSharper runner to fix #17

  • Loading branch information...
agross committed Jan 25, 2013
1 parent ac539c4 commit 21d05343452f2bd28a1ede00e5d04aa1c69b36e0
Showing with 308 additions and 84 deletions.
  1. +6 −1 Source/Machine.Specifications.ReSharperRunner.6.1/Factories/UnitTestTaskFactory.cs
  2. +2 −0 Source/Machine.Specifications.ReSharperRunner.6.1/Machine.Specifications.ReSharperRunner.6.1.csproj
  3. +3 −0 Source/Machine.Specifications.ReSharperRunner.6.1/Presentation/Element.cs
  4. +27 −6 ...ications.ReSharperRunner.6.1/Runners/Notifications/BehaviorSpecificationRemoteTaskNotification.cs
  5. +52 −0 ...Machine.Specifications.ReSharperRunner.6.1/Runners/Notifications/ContextRemoteTaskNotification.cs
  6. +28 −4 ...fications.ReSharperRunner.6.1/Runners/Notifications/ContextSpecificationRemoteTaskNotification.cs
  7. +3 −23 Source/Machine.Specifications.ReSharperRunner.6.1/Runners/Notifications/RemoteTaskNotification.cs
  8. +6 −1 ...Machine.Specifications.ReSharperRunner.6.1/Runners/Notifications/RemoteTaskNotificationFactory.cs
  9. +4 −9 .../Machine.Specifications.ReSharperRunner.6.1/Runners/Notifications/SilentRemoteTaskNotification.cs
  10. +43 −21 Source/Machine.Specifications.ReSharperRunner.6.1/Runners/PerContextRunListener.cs
  11. +28 −17 Source/Machine.Specifications.ReSharperRunner.6.1/Runners/RecursiveMSpecTaskRunner.cs
  12. +1 −1 Source/Machine.Specifications.ReSharperRunner.6.1/Tasks/ContextTask.cs
  13. +74 −0 Source/Machine.Specifications.ReSharperRunner.6.1/Tasks/RunAssemblyContextsTask.cs
  14. +1 −1 Source/Machine.Specifications.ReSharperRunner.6.1/Tasks/Task.cs
  15. +6 −0 Source/Machine.Specifications.ReSharperRunner.7.0/Machine.Specifications.ReSharperRunner.7.0.csproj
  16. +6 −0 Source/Machine.Specifications.ReSharperRunner.7.1/Machine.Specifications.ReSharperRunner.7.1.csproj
  17. +6 −0 Source/Machine.Specifications.dotCoverRunner.2.0/Machine.Specifications.dotCoverRunner.2.0.csproj
  18. +6 −0 Source/Machine.Specifications.dotCoverRunner.2.1/Machine.Specifications.dotCoverRunner.2.1.csproj
  19. +6 −0 Source/Machine.Specifications.dotCoverRunner.2.2/Machine.Specifications.dotCoverRunner.2.2.csproj
@@ -1,5 +1,4 @@
using JetBrains.ReSharper.TaskRunnerFramework;
-using JetBrains.ReSharper.UnitTestExplorer;
using JetBrains.ReSharper.UnitTestFramework;
using Machine.Specifications.ReSharperRunner.Presentation;
@@ -22,6 +21,12 @@ public UnitTestTask CreateAssemblyLoadTask(ContextElement context)
new AssemblyLoadTask(context.AssemblyLocation));
}
+ public UnitTestTask CreateRunAssemblyTask(ContextElement context)
+ {
+ return new UnitTestTask(null,
+ new RunAssemblyTask(_providerId, context.AssemblyLocation));
+ }
+
public UnitTestTask CreateContextTask(ContextElement context, bool isExplicit)
{
return new UnitTestTask(context,
@@ -151,6 +151,7 @@
<Compile Include="PsiExtensions.cs" />
<Compile Include="Runners\ExceptionResultConverter.cs" />
<Compile Include="Runners\Notifications\BehaviorSpecificationRemoteTaskNotification.cs" />
+ <Compile Include="Runners\Notifications\ContextRemoteTaskNotification.cs" />
<Compile Include="Runners\Notifications\ContextSpecificationRemoteTaskNotification.cs" />
<Compile Include="Runners\Notifications\RemoteTaskNotification.cs" />
<Compile Include="Runners\Notifications\RemoteTaskNotificationFactory.cs" />
@@ -162,6 +163,7 @@
<Compile Include="Tasks\BehaviorTask.cs" />
<Compile Include="Tasks\ContextSpecificationTask.cs" />
<Compile Include="Tasks\ContextTask.cs" />
+ <Compile Include="Tasks\RunAssemblyContextsTask.cs" />
<Compile Include="Tasks\Task.cs" />
</ItemGroup>
<ItemGroup>
@@ -197,6 +197,7 @@ public IList<UnitTestTask> GetTaskSequence(IList<IUnitTestElement> explicitEleme
return new List<UnitTestTask>
{
_taskFactory.CreateAssemblyLoadTask(context),
+ _taskFactory.CreateRunAssemblyTask(context),
_taskFactory.CreateContextTask(context, explicitElements.Contains(context)),
_taskFactory.CreateContextSpecificationTask(context,
contextSpecification,
@@ -212,6 +213,7 @@ public IList<UnitTestTask> GetTaskSequence(IList<IUnitTestElement> explicitEleme
return new List<UnitTestTask>
{
_taskFactory.CreateAssemblyLoadTask(context),
+ _taskFactory.CreateRunAssemblyTask(context),
_taskFactory.CreateContextTask(context, explicitElements.Contains(context)),
_taskFactory.CreateBehaviorTask(context, behavior, explicitElements.Contains(behavior))
};
@@ -226,6 +228,7 @@ public IList<UnitTestTask> GetTaskSequence(IList<IUnitTestElement> explicitEleme
return new List<UnitTestTask>
{
_taskFactory.CreateAssemblyLoadTask(context),
+ _taskFactory.CreateRunAssemblyTask(context),
_taskFactory.CreateContextTask(context, explicitElements.Contains(context)),
_taskFactory.CreateBehaviorTask(context, behavior, explicitElements.Contains(behavior)),
_taskFactory.CreateBehaviorSpecificationTask(context,
@@ -1,12 +1,15 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
+using System.Linq;
using JetBrains.ReSharper.TaskRunnerFramework;
using Machine.Specifications.ReSharperRunner.Tasks;
+using Machine.Specifications.Runner;
namespace Machine.Specifications.ReSharperRunner.Runners.Notifications
{
- internal class BehaviorSpecificationRemoteTaskNotification : RemoteTaskNotification
+ class BehaviorSpecificationRemoteTaskNotification : RemoteTaskNotification
{
readonly TaskExecutionNode _node;
@@ -18,22 +21,40 @@ public BehaviorSpecificationRemoteTaskNotification(TaskExecutionNode node)
_task = (BehaviorSpecificationTask) node.RemoteTask;
}
- protected override string ContainingType
+ string ContainingType
{
get { return _task.BehaviorTypeName; }
}
- protected override string FieldName
+ string FieldName
{
get { return _task.SpecificationFieldName; }
}
public override IEnumerable<RemoteTask> RemoteTasks
{
- get
+ get { yield return _node.RemoteTask; }
+ }
+
+ public override bool Matches(object infoFromRunner)
+ {
+ var specification = infoFromRunner as SpecificationInfo;
+
+ if (specification == null)
{
- yield return _node.RemoteTask;
+ return false;
}
+
+ return ContainingType == specification.ContainingType &&
+ FieldName == specification.FieldName;
+ }
+
+ public override string ToString()
+ {
+ return String.Format("Behavior specification {0}.{1} with {2} remote tasks",
+ ContainingType,
+ FieldName,
+ RemoteTasks.Count());
}
}
}
@@ -0,0 +1,52 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+using JetBrains.ReSharper.TaskRunnerFramework;
+
+using Machine.Specifications.ReSharperRunner.Tasks;
+using Machine.Specifications.Runner;
+
+namespace Machine.Specifications.ReSharperRunner.Runners.Notifications
+{
+ class ContextRemoteTaskNotification : RemoteTaskNotification
+ {
+ readonly TaskExecutionNode _node;
+ readonly ContextTask _task;
+
+ public ContextRemoteTaskNotification(TaskExecutionNode node)
+ {
+ _node = node;
+ _task = (ContextTask) node.RemoteTask;
+ }
+
+ string ContainingType
+ {
+ get { return _task.ContextTypeName; }
+ }
+
+ public override IEnumerable<RemoteTask> RemoteTasks
+ {
+ get { yield return _node.RemoteTask; }
+ }
+
+ public override bool Matches(object infoFromRunner)
+ {
+ var context = infoFromRunner as ContextInfo;
+
+ if (context == null)
+ {
+ return false;
+ }
+
+ return ContainingType == context.TypeName;
+ }
+
+ public override string ToString()
+ {
+ return String.Format("Context {0} with {1} remote tasks",
+ ContainingType,
+ RemoteTasks.Count());
+ }
+ }
+}
@@ -1,12 +1,15 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
+using System.Linq;
using JetBrains.ReSharper.TaskRunnerFramework;
using Machine.Specifications.ReSharperRunner.Tasks;
+using Machine.Specifications.Runner;
namespace Machine.Specifications.ReSharperRunner.Runners.Notifications
{
- internal class ContextSpecificationRemoteTaskNotification : RemoteTaskNotification
+ class ContextSpecificationRemoteTaskNotification : RemoteTaskNotification
{
readonly TaskExecutionNode _node;
readonly ContextSpecificationTask _task;
@@ -17,12 +20,12 @@ public ContextSpecificationRemoteTaskNotification(TaskExecutionNode node)
_task = (ContextSpecificationTask) node.RemoteTask;
}
- protected override string ContainingType
+ string ContainingType
{
get { return _task.ContextTypeName; }
}
- protected override string FieldName
+ string FieldName
{
get { return _task.SpecificationFieldName; }
}
@@ -31,5 +34,26 @@ public override IEnumerable<RemoteTask> RemoteTasks
{
get { yield return _node.RemoteTask; }
}
+
+ public override bool Matches(object infoFromRunner)
+ {
+ var specification = infoFromRunner as SpecificationInfo;
+
+ if (specification == null)
+ {
+ return false;
+ }
+
+ return ContainingType == specification.ContainingType &&
+ FieldName == specification.FieldName;
+ }
+
+ public override string ToString()
+ {
+ return String.Format("Context specification {0}.{1} with {2} remote tasks",
+ ContainingType,
+ FieldName,
+ RemoteTasks.Count());
+ }
}
}
@@ -2,31 +2,11 @@
using JetBrains.ReSharper.TaskRunnerFramework;
-using Machine.Specifications.Runner;
-
namespace Machine.Specifications.ReSharperRunner.Runners.Notifications
{
- internal abstract class RemoteTaskNotification
+ abstract class RemoteTaskNotification
{
- protected abstract string ContainingType
- {
- get;
- }
-
- protected abstract string FieldName
- {
- get;
- }
-
- public abstract IEnumerable<RemoteTask> RemoteTasks
- {
- get;
- }
-
- public virtual bool Matches(SpecificationInfo specification)
- {
- return ContainingType == new NormalizedTypeName(specification.ContainingType) &&
- FieldName == specification.FieldName;
- }
+ public abstract IEnumerable<RemoteTask> RemoteTasks { get; }
+ public abstract bool Matches(object infoFromRunner);
}
}
@@ -4,12 +4,17 @@
namespace Machine.Specifications.ReSharperRunner.Runners.Notifications
{
- internal class RemoteTaskNotificationFactory
+ class RemoteTaskNotificationFactory
{
public RemoteTaskNotification CreateTaskNotification(TaskExecutionNode node)
{
var remoteTask = node.RemoteTask;
+ if (remoteTask is ContextTask)
+ {
+ return new ContextRemoteTaskNotification(node);
+ }
+
if (remoteTask is ContextSpecificationTask)
{
return new ContextSpecificationRemoteTaskNotification(node);
@@ -6,19 +6,14 @@ namespace Machine.Specifications.ReSharperRunner.Runners.Notifications
{
internal class SilentRemoteTaskNotification : RemoteTaskNotification
{
- protected override string ContainingType
- {
- get { return null; }
- }
-
- protected override string FieldName
+ public override IEnumerable<RemoteTask> RemoteTasks
{
- get { return null; }
+ get { yield break; }
}
- public override IEnumerable<RemoteTask> RemoteTasks
+ public override bool Matches(object infoFromRunner)
{
- get { yield break; }
+ return false;
}
}
}
Oops, something went wrong.

0 comments on commit 21d0534

Please sign in to comment.