Skip to content

Commit

Permalink
Merge pull request #149 from nunit/Issue143
Browse files Browse the repository at this point in the history
Added searchdirectories to the navigation  #143 #147
  • Loading branch information
OsirisTerje authored Mar 27, 2017
2 parents db31109 + cc5da16 commit 4befe35
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 11 deletions.
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: 2.1.{build}
version: 2.2.{build}
image: Visual Studio 2015

build_script:
Expand Down
2 changes: 1 addition & 1 deletion build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var configuration = Argument("configuration", "Debug");
// SET PACKAGE VERSION
//////////////////////////////////////////////////////////////////////

var version = "2.1.1";
var version = "2.2.0";
var modifier = "";

var dbgSuffix = configuration == "Debug" ? "-dbg" : "";
Expand Down
23 changes: 17 additions & 6 deletions src/NUnitTestAdapter/NavigationDataProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,15 @@ public NavigationData GetNavigationData(string className, string methodName)
{
methodDef = typeDef
.GetMethods()
.Where(o => o.Name == methodName)
.FirstOrDefault();
.FirstOrDefault(o => o.Name == methodName);

if (methodDef != null)
break;

var baseType = typeDef.BaseType;
if (baseType == null || baseType.FullName == "System.Object")
return NavigationData.Invalid;

typeDef = typeDef.BaseType.Resolve();
typeDef = typeDef.BaseType.Resolve();
}

var sequencePoint = FirstOrDefaultSequencePoint(methodDef);
Expand All @@ -77,14 +75,27 @@ public NavigationData GetNavigationData(string className, string methodName)

static IDictionary<string, TypeDefinition> CacheTypes(string assemblyPath)
{
var readsymbols = DoesPdbFileExist(assemblyPath);
var readerParameters = new ReaderParameters() { ReadSymbols = readsymbols };
var paths = new List<string>();
var resolver = new DefaultAssemblyResolver();
var path = Path.GetDirectoryName(assemblyPath);
paths.Add(path);
resolver.AddSearchDirectory(path);
var readsymbols = DoesPdbFileExist(assemblyPath);
var readerParameters = new ReaderParameters { ReadSymbols = readsymbols,AssemblyResolver = resolver};
var module = ModuleDefinition.ReadModule(assemblyPath, readerParameters);

var types = new Dictionary<string, TypeDefinition>();

foreach (var type in module.GetTypes())
{
var directory = Path.GetDirectoryName(type.Module.FullyQualifiedName);
if (!paths.Contains(directory))
{
resolver.AddSearchDirectory(directory);
paths.Add(directory);
}
types[type.FullName] = type;
}

return types;
}
Expand Down
4 changes: 2 additions & 2 deletions src/NUnitTestAdapter/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@
[assembly: ComVisible(false)]

[assembly: Guid("c0aad5e4-b486-49bc-b3e8-31e01be6fefe")]
[assembly: AssemblyVersion("2.1.1.0")]
[assembly: AssemblyFileVersion("2.1.1.0")]
[assembly: AssemblyVersion("2.2.0.0")]
[assembly: AssemblyFileVersion("2.2.0.0")]
2 changes: 1 addition & 1 deletion src/NUnitTestAdapterInstall/source.extension.vsixmanifest
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="NUnitTestAdapterInstall..7c53286e-ac4f-485f-915c-5ec5a4c47b0c" Version="2.1.1" Language="en-US" Publisher="Charlie Poole" />
<Identity Id="NUnitTestAdapterInstall..7c53286e-ac4f-485f-915c-5ec5a4c47b0c" Version="2.2.0.0" Language="en-US" Publisher="Charlie Poole" />
<DisplayName>NUnit 2 Test Adapter</DisplayName>
<Description xml:space="preserve">NUnit 2 adapter for running tests in Visual Studio 2012 and newer. Works with NUnit 2.x, for 3.x tests use the NUnit 3 adapter.</Description>
<MoreInfo>https://github.com/nunit/docs/wiki/VS-Adapter</MoreInfo>
Expand Down

0 comments on commit 4befe35

Please sign in to comment.