diff --git a/.gitignore b/.gitignore
index e607b5b..e3db126 100644
--- a/.gitignore
+++ b/.gitignore
@@ -96,7 +96,7 @@ publish/
# NuGet Packages Directory
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
-#packages/
+packages/
# Windows Azure Build Output
csx
@@ -161,3 +161,5 @@ packages
!packages/*/build/
/OpenCover.UI.VS2013.sln.DotSettings
OpenCover/
+
+\.vs/
diff --git a/OpenCover.UI.TestDiscoverer.TestResources/OpenCover.UI.TestDiscoverer.TestResources.csproj b/OpenCover.UI.TestDiscoverer.TestResources/OpenCover.UI.TestDiscoverer.TestResources.csproj
index d8b174a..a4fd0b8 100644
--- a/OpenCover.UI.TestDiscoverer.TestResources/OpenCover.UI.TestDiscoverer.TestResources.csproj
+++ b/OpenCover.UI.TestDiscoverer.TestResources/OpenCover.UI.TestDiscoverer.TestResources.csproj
@@ -40,7 +40,12 @@
Key.snk
-
+
+ ..\packages\Microsoft.VisualStudio.TestPlatform.14.0.0.1\lib\net20\Microsoft.VisualStudio.TestPlatform.TestFramework.dll
+
+
+ ..\packages\Microsoft.VisualStudio.TestPlatform.14.0.0.1\lib\net20\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll
+
..\packages\NUnit.2.6.3\lib\nunit.framework.dll
@@ -97,4 +102,4 @@
-->
-
+
\ No newline at end of file
diff --git a/OpenCover.UI.TestDiscoverer.TestResources/packages.config b/OpenCover.UI.TestDiscoverer.TestResources/packages.config
index a62ac3d..f90f5f3 100644
--- a/OpenCover.UI.TestDiscoverer.TestResources/packages.config
+++ b/OpenCover.UI.TestDiscoverer.TestResources/packages.config
@@ -1,5 +1,6 @@
+
diff --git a/OpenCover.UI.TestDiscoverer.Tests/MSTest/MSTestDiscovererTests.cs b/OpenCover.UI.TestDiscoverer.Tests/MSTest/MSTestDiscovererTests.cs
index 131d453..0c223f8 100644
--- a/OpenCover.UI.TestDiscoverer.Tests/MSTest/MSTestDiscovererTests.cs
+++ b/OpenCover.UI.TestDiscoverer.Tests/MSTest/MSTestDiscovererTests.cs
@@ -21,20 +21,20 @@ public void Discover_Finds_Sub_Test_Fixtures_And_Methods(Type testFixtureInAssem
AssertDiscoveredMethod(testFixtureInAssemblyToDiscoverTestsIn, expectedNameOfFirstTestMethod, TestType.MSTest);
}
- [Ignore("MsTest Discoverer doesn't find base class methods yet"),
- TestCase(typeof(TestFixtureInheritingTraitMethods),
- "TestMethod_TestFixtureWithTraits",
+ [Ignore("MsTest Discoverer doesn't find base class methods yet"),
+ TestCase(typeof(TestFixtureInheritingTraitMethods),
+ "TestMethod_TestFixtureWithTraits",
new[] { "Category_TestMethod_TestFixtureWithTraits" })]
public void Discover_Finds_Inherited_Fixtures_And_Methods_With_Traits(Type testFixtureInAssemblyToDiscoverTestsIn, string expectedNameOfFirstTestMethod, string[] expectedTraits)
{
AssertDiscoveredMethod(testFixtureInAssemblyToDiscoverTestsIn, expectedNameOfFirstTestMethod, TestType.MSTest, expectedTraits);
}
- [TestCase(typeof(TestFixtureWithTraits),
- "TestMethod_TestFixtureWithTraits",
+ [TestCase(typeof(TestFixtureWithTraits),
+ "TestMethod_TestFixtureWithTraits",
new[] { "Category_TestMethod_TestFixtureWithTraits" })]
- [TestCase(typeof(TestFixtureInheritingTraitMethods),
- "TestMethod_TestFixtureInheritingTraitMethods",
+ [TestCase(typeof(TestFixtureInheritingTraitMethods),
+ "TestMethod_TestFixtureInheritingTraitMethods",
new[] { "Category_TestMethod_TestFixtureInheritingTraitMethods_1",
"Category_TestMethod_TestFixtureInheritingTraitMethods_2" })]
public void Discover_Finds_Fixtures_And_Methods_With_Traits(Type testFixtureInAssemblyToDiscoverTestsIn, string expectedNameOfFirstTestMethod, string[] expectedTraits)
diff --git a/OpenCover.UI.TestDiscoverer.Tests/NUnit/NUnitDiscovererTests.cs b/OpenCover.UI.TestDiscoverer.Tests/NUnit/NUnitDiscovererTests.cs
index 081e743..d0743d3 100644
--- a/OpenCover.UI.TestDiscoverer.Tests/NUnit/NUnitDiscovererTests.cs
+++ b/OpenCover.UI.TestDiscoverer.Tests/NUnit/NUnitDiscovererTests.cs
@@ -5,23 +5,23 @@
namespace OpenCover.UI.TestDiscoverer.Tests.NUnit
{
- class NUnitDiscovererTests : DiscovererTestsBase
- {
- [TestCase(typeof(RegularTestFixture), "RegularTestMethod", null)]
- [TestCase(typeof(TestFixtureWithoutExplicitTestFixtureAttribute), "TestMethodInTestFixtureWithoutExplicitTestFixtureAttribute", null)]
- [TestCase(typeof(TestFixtureWithTestCase), "SomeTestCase", null)]
- [TestCase(typeof(TestFixtureWithNamedTestCase), "SomeNamedTestCase", null)]
- [TestCase(typeof(TestFixtureWithInheritedTraitTestCase), "SomeTraitTestMethod", new string[] { "InheritedTrait", "ClassTrait" })]
- public void Discover_Finds_Regular_Test_Fixture_And_Method(Type testFixtureInAssemblyToDiscoverTestsIn, string expectedNameOfFirstTestMethod, string[] expectedTraits)
- {
- AssertDiscoveredMethod(testFixtureInAssemblyToDiscoverTestsIn, expectedNameOfFirstTestMethod, TestType.NUnit, expectedTraits);
- }
+ //class NUnitDiscovererTests : DiscovererTestsBase
+ //{
+ // [TestCase(typeof(RegularTestFixture), "RegularTestMethod", null)]
+ // [TestCase(typeof(TestFixtureWithoutExplicitTestFixtureAttribute), "TestMethodInTestFixtureWithoutExplicitTestFixtureAttribute", null)]
+ // [TestCase(typeof(TestFixtureWithTestCase), "SomeTestCase", null)]
+ // [TestCase(typeof(TestFixtureWithNamedTestCase), "SomeNamedTestCase", null)]
+ // [TestCase(typeof(TestFixtureWithInheritedTraitTestCase), "SomeTraitTestMethod", new string[] { "InheritedTrait", "ClassTrait" })]
+ // public void Discover_Finds_Regular_Test_Fixture_And_Method(Type testFixtureInAssemblyToDiscoverTestsIn, string expectedNameOfFirstTestMethod, string[] expectedTraits)
+ // {
+ // AssertDiscoveredMethod(testFixtureInAssemblyToDiscoverTestsIn, expectedNameOfFirstTestMethod, TestType.NUnit, expectedTraits);
+ // }
- [TestCase(typeof(TestFixtureWithNestedTestClasses.SubTestClass), "RegularSubTestClassMethod")]
- [TestCase(typeof(TestFixtureWithNestedTestClasses.SubTestClass.Sub2NdTestClass), "RegularSub2NdTestClassMethod")]
- public void Discover_Finds_Sub_Test_Fixtures_And_Methods(Type testFixtureInAssemblyToDiscoverTestsIn, string expectedNameOfFirstTestMethod)
- {
- AssertDiscoveredMethod(testFixtureInAssemblyToDiscoverTestsIn, expectedNameOfFirstTestMethod, TestType.NUnit);
- }
- }
+ // [TestCase(typeof(TestFixtureWithNestedTestClasses.SubTestClass), "RegularSubTestClassMethod")]
+ // [TestCase(typeof(TestFixtureWithNestedTestClasses.SubTestClass.Sub2NdTestClass), "RegularSub2NdTestClassMethod")]
+ // public void Discover_Finds_Sub_Test_Fixtures_And_Methods(Type testFixtureInAssemblyToDiscoverTestsIn, string expectedNameOfFirstTestMethod)
+ // {
+ // AssertDiscoveredMethod(testFixtureInAssemblyToDiscoverTestsIn, expectedNameOfFirstTestMethod, TestType.NUnit);
+ // }
+ //}
}
diff --git a/OpenCover.UI.TestDiscoverer.Tests/OpenCover.UI.TestDiscoverer.Tests.csproj b/OpenCover.UI.TestDiscoverer.Tests/OpenCover.UI.TestDiscoverer.Tests.csproj
index 94830c7..47455e6 100644
--- a/OpenCover.UI.TestDiscoverer.Tests/OpenCover.UI.TestDiscoverer.Tests.csproj
+++ b/OpenCover.UI.TestDiscoverer.Tests/OpenCover.UI.TestDiscoverer.Tests.csproj
@@ -13,7 +13,7 @@
512
..\
true
-
+
true
full
diff --git a/OpenCover.UI.TestDiscoverer.Tests/XUnit/XUnitDiscovererTests.cs b/OpenCover.UI.TestDiscoverer.Tests/XUnit/XUnitDiscovererTests.cs
index e2d8b5c..4cd18d5 100644
--- a/OpenCover.UI.TestDiscoverer.Tests/XUnit/XUnitDiscovererTests.cs
+++ b/OpenCover.UI.TestDiscoverer.Tests/XUnit/XUnitDiscovererTests.cs
@@ -9,23 +9,23 @@
namespace OpenCover.UI.TestDiscoverer.Tests.XUnit
{
- [Ignore]
- [TestFixture]
- class XUnitDiscovererTests : DiscovererTestsBase
- {
- [TestCase(typeof(RegularxUnitTestClass), "RegularTestMethod")]
- public void Discover_Finds_Regular_Test_Fixture_And_Method(Type testFixtureInAssemblyToDiscoverTestsIn, string expectedNameOfFirstTestMethod)
- {
- AssertDiscoveredMethod(testFixtureInAssemblyToDiscoverTestsIn, expectedNameOfFirstTestMethod, TestType.XUnit);
- }
+ //[Ignore]
+ //[TestFixture]
+ //class XUnitDiscovererTests : DiscovererTestsBase
+ //{
+ // [TestCase(typeof(RegularxUnitTestClass), "RegularTestMethod")]
+ // public void Discover_Finds_Regular_Test_Fixture_And_Method(Type testFixtureInAssemblyToDiscoverTestsIn, string expectedNameOfFirstTestMethod)
+ // {
+ // AssertDiscoveredMethod(testFixtureInAssemblyToDiscoverTestsIn, expectedNameOfFirstTestMethod, TestType.XUnit);
+ // }
- [TestCase(typeof(RegularxUnitTestClass.SubTestClass), "RegularSubTestClassMethod")]
- [TestCase(typeof(RegularxUnitTestClass.SubTestClass.Sub2NdTestClass), "RegularSub2NdTestClassMethod")]
- public void Discover_Finds_Sub_Test_Fixtures_And_Methods(Type testFixtureInAssemblyToDiscoverTestsIn, string expectedNameOfFirstTestMethod)
- {
- AssertDiscoveredMethod(testFixtureInAssemblyToDiscoverTestsIn, expectedNameOfFirstTestMethod, TestType.XUnit);
- }
+ // [TestCase(typeof(RegularxUnitTestClass.SubTestClass), "RegularSubTestClassMethod")]
+ // [TestCase(typeof(RegularxUnitTestClass.SubTestClass.Sub2NdTestClass), "RegularSub2NdTestClassMethod")]
+ // public void Discover_Finds_Sub_Test_Fixtures_And_Methods(Type testFixtureInAssemblyToDiscoverTestsIn, string expectedNameOfFirstTestMethod)
+ // {
+ // AssertDiscoveredMethod(testFixtureInAssemblyToDiscoverTestsIn, expectedNameOfFirstTestMethod, TestType.XUnit);
+ // }
- }
+ //}
}
diff --git a/OpenCover.UI.TestDiscoverer/OpenCover.UI.TestDiscoverer.csproj b/OpenCover.UI.TestDiscoverer/OpenCover.UI.TestDiscoverer.csproj
index dca879b..aa54918 100644
--- a/OpenCover.UI.TestDiscoverer/OpenCover.UI.TestDiscoverer.csproj
+++ b/OpenCover.UI.TestDiscoverer/OpenCover.UI.TestDiscoverer.csproj
@@ -42,7 +42,12 @@
Key.snk
-
+
+ ..\packages\Microsoft.VisualStudio.TestPlatform.14.0.0.1\lib\net20\Microsoft.VisualStudio.TestPlatform.TestFramework.dll
+
+
+ ..\packages\Microsoft.VisualStudio.TestPlatform.14.0.0.1\lib\net20\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll
+
..\OpenCover.UI\Lib\Mono.Cecil.dll
diff --git a/OpenCover.UI.TestDiscoverer/Program.cs b/OpenCover.UI.TestDiscoverer/Program.cs
index 57f1beb..f0bc6e5 100644
--- a/OpenCover.UI.TestDiscoverer/Program.cs
+++ b/OpenCover.UI.TestDiscoverer/Program.cs
@@ -9,52 +9,80 @@
namespace OpenCover.UI.TestDiscoverer
{
- class Program
- {
- static void Main(string[] args)
- {
- try
- {
- if (args.Length > 1)
- {
- NamedPipeClientStream pipeClient = new NamedPipeClientStream(".", args[0], PipeDirection.InOut);
- pipeClient.Connect();
- Discover(args, pipeClient);
-
- pipeClient.WaitForPipeDrain();
-
- pipeClient.Close();
- }
- }
- catch (Exception ex)
- {
- Console.WriteLine(ex.Message);
- }
- }
-
- private static void Discover(string[] args, NamedPipeClientStream stream)
- {
- if (args != null && args.Length > 0)
- {
+ class Program
+ {
+ static void Main(string[] args)
+ {
+ try
+ {
+ Log("START");
+ //args = $@"bdf0d464-5bcc-4a4f-aaa3-0d2d1bafe5e4, I:\ConsoleApp1\ConsoleApp1.Tests\bin\Debug\ConsoleApp1.Tests.dll".Split(',').Select(s => s.Trim()).ToArray();
+ if (args.Length > 1)
+ {
+ Log(string.Join(", ", args));
+ Log("Creating client");
+ NamedPipeClientStream pipeClient = new NamedPipeClientStream(".", args[0], PipeDirection.InOut);
+ Log("Client connecting");
+ pipeClient.Connect();
+ Log("Starting discovery");
+ Discover(args, pipeClient);
+
+ Log("Waiting for pipedrain");
+ pipeClient.WaitForPipeDrain();
+
+ Log("Closing connection");
+ pipeClient.Close();
+ Log("Connection closed");
+ }
+ }
+ catch (Exception ex)
+ {
+ Log("EXCEPTION");
+ Log(ex.Message);
+ Console.WriteLine(ex.Message);
+ }
+ }
+ public static void Log(string logMessage)
+ {
+ string filePath = $@"C:\myFile.txt";
+ if (!File.Exists(filePath))
+ {
+ File.Create(filePath);
+ }
+ using (StreamWriter w = File.AppendText(filePath))
+ {
+ w.WriteLine(logMessage + System.Environment.NewLine);
+ }
+ }
+
+ private static void Discover(string[] args, NamedPipeClientStream stream)
+ {
+ Log("In discovery");
+ if (args != null && args.Length > 0)
+ {
var dlls = args.Skip(1);
+
+ Log("DLLS: " + dlls);
var tests = new Discoverer(dlls).Discover();
- string serialized = String.Empty;
-
- if (tests != null)
- {
- var jsSerializer = new JavaScriptSerializer();
- serialized = jsSerializer.Serialize(tests);
- }
-
- Write(stream, serialized);
- }
- }
-
- private static void Write(Stream stream, string json)
- {
- var writer = new StreamWriter(stream);
- writer.Write(json);
- writer.Flush();
- }
- }
+ Log("Tests" + tests ?? "Geen tests gevonden");
+ string serialized = String.Empty;
+
+ if (tests != null)
+ {
+ var jsSerializer = new JavaScriptSerializer();
+ serialized = jsSerializer.Serialize(tests);
+ }
+ Log("Tests" + serialized);
+
+ Write(stream, serialized);
+ }
+ }
+
+ private static void Write(Stream stream, string json)
+ {
+ var writer = new StreamWriter(stream);
+ writer.Write(json);
+ writer.Flush();
+ }
+ }
}
\ No newline at end of file
diff --git a/OpenCover.UI.TestDiscoverer/packages.config b/OpenCover.UI.TestDiscoverer/packages.config
index a62ac3d..f90f5f3 100644
--- a/OpenCover.UI.TestDiscoverer/packages.config
+++ b/OpenCover.UI.TestDiscoverer/packages.config
@@ -1,5 +1,6 @@
+
diff --git a/OpenCover.UI.Tests/OpenCover.UI.Tests.csproj b/OpenCover.UI.Tests/OpenCover.UI.Tests.csproj
index 4cbb740..7021011 100644
--- a/OpenCover.UI.Tests/OpenCover.UI.Tests.csproj
+++ b/OpenCover.UI.Tests/OpenCover.UI.Tests.csproj
@@ -49,9 +49,11 @@
False
..\packages\CommonServiceLocator.1.3\lib\portable-net4+sl5+netcore45+wpa81+wp8\Microsoft.Practices.ServiceLocation.dll
-
- False
- ..\..\..\..\..\..\..\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\ReferenceAssemblies\v4.0\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll
+
+ ..\packages\Microsoft.VisualStudio.TestPlatform.14.0.0.1\lib\net20\Microsoft.VisualStudio.TestPlatform.TestFramework.dll
+
+
+ ..\packages\Microsoft.VisualStudio.TestPlatform.14.0.0.1\lib\net20\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll
..\packages\NSubstitute.1.8.1.0\lib\net45\NSubstitute.dll
diff --git a/OpenCover.UI.Tests/packages.config b/OpenCover.UI.Tests/packages.config
index 44b6c96..556a3f6 100644
--- a/OpenCover.UI.Tests/packages.config
+++ b/OpenCover.UI.Tests/packages.config
@@ -1,6 +1,7 @@
+
diff --git a/OpenCover.UI/Glyphs/LineCoverageGlyphFactory.cs b/OpenCover.UI/Glyphs/LineCoverageGlyphFactory.cs
index f1d777d..53d7aff 100644
--- a/OpenCover.UI/Glyphs/LineCoverageGlyphFactory.cs
+++ b/OpenCover.UI/Glyphs/LineCoverageGlyphFactory.cs
@@ -27,7 +27,7 @@ namespace OpenCover.UI.Glyphs
public class LineCoverageGlyphFactory : TextViewCoverageProviderBase, IGlyphFactory
{
const double _glyphSize = 12.0;
-
+
private static Brush _redBrush = new SolidColorBrush(Color.FromRgb(196, 64, 47));
private static Brush _greenBrush = new SolidColorBrush(Color.FromRgb(88, 196, 84));
private static Brush _orangeBrush = new SolidColorBrush(Color.FromRgb(196, 136, 41));
@@ -36,9 +36,9 @@ public class LineCoverageGlyphFactory : TextViewCoverageProviderBase, IGlyphFact
/// Initializes a new instance.
///
/// The current text editor.
- public LineCoverageGlyphFactory(IWpfTextView view) :base(view)
+ public LineCoverageGlyphFactory(IWpfTextView view) : base(view)
{
-
+
}
///
@@ -61,10 +61,11 @@ public UIElement GenerateGlyph(IWpfTextViewLine line, IGlyphTag tag)
if (brush == null)
return null;
- System.Windows.Shapes.Ellipse ellipse = new Ellipse();
+ System.Windows.Shapes.Rectangle ellipse = new Rectangle();
ellipse.Fill = brush;
- ellipse.Height = _glyphSize;
- ellipse.Width = _glyphSize;
+ ellipse.Height = 14;
+ ellipse.Width = 3;
+ ellipse.HorizontalAlignment = HorizontalAlignment.Right;
ellipse.ToolTip = GetToolTipText(state);
@@ -76,7 +77,7 @@ public UIElement GenerateGlyph(IWpfTextViewLine line, IGlyphTag tag)
}
return ellipse;
- }
+ }
///
/// Determines the correct brush for the coverage state.
@@ -86,7 +87,7 @@ public UIElement GenerateGlyph(IWpfTextViewLine line, IGlyphTag tag)
private Brush GetBrushForState(LineCoverageState state)
{
switch (state)
- {
+ {
case LineCoverageState.Covered:
return _greenBrush;
case LineCoverageState.Uncovered:
@@ -127,7 +128,7 @@ private LineCoverageState GetLineCoverageState(ITextViewLine line)
{
// get cover state for all spans included in this line
var spans = GetSpansForLine(line, _currentSpans);
-
+
if (spans.Any())
{
IEnumerable coverageStates = spans.Select(s => _spanCoverage[s]);
@@ -144,7 +145,7 @@ private LineCoverageState GetLineCoverageState(ITextViewLine line)
return LineCoverageState.Partly;
}
}
-
+
return LineCoverageState.Unknown;
}
@@ -158,7 +159,7 @@ public static IEnumerable GetSpansForLine(ITextViewLine line, IEnu
{
return spanContainer.Where(s => s.Snapshot.Version == line.Snapshot.Version)
.Where(s => (s.Start >= line.Start && s.Start <= line.End) || (s.Start < line.Start && s.End >= line.Start));
- }
+ }
///
/// Hide the colored line
@@ -185,6 +186,6 @@ void OnGlyphMouseEnter(object sender, System.Windows.Input.MouseEventArgs e)
if (tagger != null)
tagger.ShowForLine(line);
- }
+ }
}
}
diff --git a/OpenCover.UI/Guids.cs b/OpenCover.UI/Guids.cs
index 53fdf4a..72c3734 100644
--- a/OpenCover.UI/Guids.cs
+++ b/OpenCover.UI/Guids.cs
@@ -2,20 +2,23 @@
// This source code is released under the MIT License; Please read license.md file for more details.
//
using System;
+using System.IO;
namespace OpenCover.UI
{
- static class GuidList
- {
- public const string GuidOpenCoverUIPkgString = "8baa86ee-ed13-4508-bccf-d580eaf81949";
- public const string GuidOpenCoverUICmdSetString = "c1d4257b-f994-4cfe-adb6-f780c29f7c48";
- public const string GuidToolWindowPersistanceString = "47dfb4eb-7c9f-45a8-938e-90fde05d0387";
- public const string GuidTestExplorerToolWindowString = "E1B7D1F8-9B3C-49B1-8F4F-BFC63A88835D";
- public const string GuidTestExplorerToolWindowContextMenu = "1E198C22-5980-4E7E-92F3-F73168D1FB63";
+ static class GuidList
+ {
+ public const string GuidOpenCoverUIPkgString = "8baa86ee-ed13-4508-bccf-d580eaf81949";
+ public const string GuidOpenCoverUICmdSetString = "c1d4257b-f994-4cfe-adb6-f780c29f7c48";
+ public const string GuidToolWindowPersistanceString = "47dfb4eb-7c9f-45a8-938e-90fde05d0387";
+ public const string GuidTestExplorerToolWindowString = "E1B7D1F8-9B3C-49B1-8F4F-BFC63A88835D";
+ public const string GuidTestExplorerToolWindowContextMenu = "1E198C22-5980-4E7E-92F3-F73168D1FB63";
public const string GuidOpenCoverUIOptionPage = "D4BE3BE5-444A-4946-B6DF-CF422D3A1875";
- public static readonly Guid GuidOpenCoverUICmdSet = new Guid(GuidOpenCoverUICmdSetString);
- public static Guid GuidOpenCoverTestExplorerContextMenuCommandSet = new Guid("81F1321F-B605-47F6-AD43-FB2EC4891225");
- };
+ public static readonly Guid GuidOpenCoverUICmdSet = new Guid(GuidOpenCoverUICmdSetString);
+ public static Guid GuidOpenCoverTestExplorerContextMenuCommandSet = new Guid("81F1321F-B605-47F6-AD43-FB2EC4891225");
+
+
+ };
}
\ No newline at end of file
diff --git a/OpenCover.UI/Helpers/IDEHelper.cs b/OpenCover.UI/Helpers/IDEHelper.cs
index 9f494dc..c3747ca 100644
--- a/OpenCover.UI/Helpers/IDEHelper.cs
+++ b/OpenCover.UI/Helpers/IDEHelper.cs
@@ -17,438 +17,438 @@
namespace OpenCover.UI.Helpers
{
- internal static class IDEHelper
- {
- private const string BASE_IMAGE_PREFIX = "/OpenCover.UI;component/";
-
- private static IVsOutputWindow _outputWindow;
- private static IVsOutputWindowPane _pane;
- private static EnvDTE.DTE DTE;
-
- ///
- /// Initializes the class.
- ///
- static IDEHelper()
- {
- _outputWindow = Package.GetGlobalService(typeof(SVsOutputWindow)) as IVsOutputWindow;
-
- Guid guidGeneral = VSConstants.OutputWindowPaneGuid.GeneralPane_guid;
- int hr = _outputWindow.CreatePane(guidGeneral, "OpenCover", 1, 1);
- hr = _outputWindow.GetPane(guidGeneral, out _pane);
-
- DTE = (Package.GetGlobalService(typeof(EnvDTE.DTE))) as EnvDTE.DTE;
- }
-
- ///
- /// Opens the file in Visual Studio.
- ///
- /// The file path.
- internal static void OpenFile(EnvDTE.DTE DTE, string file)
- {
- try
- {
- if (System.IO.File.Exists(file))
- {
- DTE.ItemOperations.OpenFile(file);
- }
- }
- catch (Exception ex)
- {
- Debug.WriteLine(ex.Message);
- }
- }
-
- ///
- /// Closes the file.
- ///
- /// The DTE.
- /// Name of the file.
- internal static void CloseFile(EnvDTE.DTE DTE, string fileName)
- {
- foreach (EnvDTE.Document document in DTE.Documents)
- {
- if (fileName.Equals(document.FullName, StringComparison.InvariantCultureIgnoreCase))
- {
- document.Close();
- break;
- }
- }
- }
-
- ///
- /// Moves the caret to line number.
- ///
- /// The DTE.
- /// The line number.
- internal static void GoToLine(EnvDTE.DTE DTE, int lineNumber)
- {
- DTE.ExecuteCommand("GotoLn", lineNumber.ToString());
- }
-
- ///
- /// Writes to the output window.
- ///
- /// The message.
- internal static void WriteToOutputWindow(string message)
- {
- try
- {
- if (_pane != null)
- {
- _pane.OutputStringThreadSafe(message);
- _pane.OutputStringThreadSafe(Environment.NewLine);
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show(String.Format("{0}\n{1}", ex.Message, ex.StackTrace), Resources.MessageBoxTitle, MessageBoxButton.OK);
- }
- }
-
- ///
- /// Writes to output window.
- ///
- /// The string format.
- /// The arguments to formatting.
- internal static void WriteToOutputWindow(string format, params object[] arguments)
- {
- WriteToOutputWindow(String.Format(format, arguments));
- }
-
-
- ///
- /// Finds all the dlls in the project with reference to UnitTestFramework.dll
- ///
- /// List of all dlls which might contain tests
- internal static IEnumerable GetPotentialTestDLLs()
- {
- string mstestPath = "Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll";
- string nunitPath = "nunit.Framework.dll";
- string xunitPath = "xunit.core.dll";
-
- List projects = new List();
-
- GetProjects(DTE.Solution.Projects, projects);
-
- foreach (var currentProject in projects)
- {
- var vsProject2 = currentProject.Object as VSProject2;
- bool isTestProject = false;
-
- if (vsProject2 != null)
- {
- foreach (Reference reference in vsProject2.References)
- {
- var referenceFile = Path.GetFileName(reference.Path);
- if (mstestPath.Equals(referenceFile, StringComparison.InvariantCultureIgnoreCase)
- || nunitPath.Equals(referenceFile, StringComparison.InvariantCultureIgnoreCase)
- || xunitPath.Equals(referenceFile, StringComparison.InvariantCultureIgnoreCase))
- {
- isTestProject = true;
- break;
- }
- }
-
- if (isTestProject)
- {
- yield return GetOutputPath(currentProject);
- }
- }
- }
-
- }
-
- ///
- /// Search for a class + method in the opened solution. When found, the corresponding file will
- /// be opened, and the specified method will be shown.
- ///
- /// Fully qualified method to search for.
- internal static void OpenFileByFullyQualifiedMethodName(string fullyQualifiedMethodName)
- {
- List projects = new List();
-
- GetProjects(DTE.Solution.Projects, projects);
-
- foreach (EnvDTE.Project project in projects)
- {
- var projectItems = project.ProjectItems;
- var found = ScanProjectItems(fullyQualifiedMethodName, projectItems);
- if (found)
- {
- if (Debugger.IsAttached)
- {
- WriteToOutputWindow("Method found, stopping solution search");
- }
-
- return;
- }
- }
-
- WriteToOutputWindow("Could not find method '{0}' in the current solution", fullyQualifiedMethodName);
- }
-
- private static bool ScanProjectItems(string fullyQualifiedMethodName, EnvDTE.ProjectItems projectItems)
- {
- foreach (EnvDTE.ProjectItem projectItem in projectItems)
- {
- if (Debugger.IsAttached)
- {
- WriteToOutputWindow("Processing projectItem: {0}", projectItem.Name);
- }
-
- if (projectItem.FileCodeModel != null)
- {
- var codeModel = (EnvDTE.FileCodeModel)projectItem.FileCodeModel;
- foreach (EnvDTE.CodeElement codeElement in codeModel.CodeElements)
- {
- EnvDTE.CodeElement discoveredMethodElement;
- if (FindMethodInCodeElement(codeElement, fullyQualifiedMethodName, out discoveredMethodElement))
- {
- var filepath = (string)projectItem.Properties.Item("FullPath").Value;
-
- WriteToOutputWindow("Method '{0}' found, opening file: '{1}'", fullyQualifiedMethodName, filepath);
- OpenFile(DTE, filepath);
-
- int methodStartLine = discoveredMethodElement.StartPoint.Line;
- WriteToOutputWindow("Moving to method on line: {0}", methodStartLine);
- GoToLine(DTE, discoveredMethodElement.StartPoint.Line);
- return true;
- }
- }
- }
- else if (projectItem.Kind == EnvDTE.Constants.vsProjectItemKindPhysicalFolder)
- {
- if (Debugger.IsAttached)
- {
- WriteToOutputWindow("Scanning subfolder: {0}", projectItem.Name);
- }
-
- var found = ScanProjectItems(fullyQualifiedMethodName, projectItem.ProjectItems);
- if (found)
- {
- return true;
- }
- }
- }
- return false;
- }
-
- private static bool FindMethodInCodeElement(EnvDTE.CodeElement codeElement, string fullyQualifiedMethodName,
- out EnvDTE.CodeElement discoveredMethodElement)
- {
- if (codeElement.Kind == EnvDTE.vsCMElement.vsCMElementClass)
- {
- if (Debugger.IsAttached)
- {
- WriteToOutputWindow("Processing class: {0}", codeElement.FullName);
- }
-
- foreach (EnvDTE.CodeElement classChildCodeElement in codeElement.Children)
- {
- if (classChildCodeElement.Kind == EnvDTE.vsCMElement.vsCMElementFunction)
- {
- if (fullyQualifiedMethodName == classChildCodeElement.FullName)
- {
- discoveredMethodElement = classChildCodeElement;
- return true;
- }
- }
- }
- }
-
- foreach (EnvDTE.CodeElement childElement in codeElement.Children)
- {
- if (FindMethodInCodeElement(childElement, fullyQualifiedMethodName, out discoveredMethodElement))
- {
- return true;
- }
- }
-
- discoveredMethodElement = null;
- return false;
- }
-
- private static void GetProjects(EnvDTE.Projects projects, List projectList)
- {
- foreach (EnvDTE.Project project in projects)
- GetProjects(project, projectList);
- }
-
- private static void GetProjects(EnvDTE.Project project, List projectList)
- {
- if (project == null)
- return;
-
- if (project.Kind.Contains("FAE04EC0-301F-11D3-BF4B-00C04F79EFBC") || project.Kind.Contains("F184B08F-C81C-45F6-A57F-5ABD9991F28F"))
- projectList.Add(project);
-
- if (project.ProjectItems == null || project.ProjectItems.Count == 0)
- return;
-
- foreach (EnvDTE.ProjectItem proj in project.ProjectItems)
- {
- var DTEProject = proj.Object as EnvDTE.Project;
- if (DTEProject != null)
- GetProjects(DTEProject, projectList);
- }
- }
-
- internal static string GetImageURL(string url)
- {
- return String.Format("{0}{1}", BASE_IMAGE_PREFIX, url);
- }
-
- ///
- /// Returns the output path of the project.
- ///
- /// The project.
- /// Output path
- internal static string GetOutputPath(EnvDTE.Project project)
- {
- string outputPath = project.ConfigurationManager != null && project.ConfigurationManager.ActiveConfiguration != null
- ? project.ConfigurationManager.ActiveConfiguration.Properties.Item("OutputPath").Value.ToString() : null;
-
- if (outputPath == null)
- {
- return null;
- }
-
- string absoluteOutputPath;
- string projectFolder;
-
- if (outputPath.StartsWith(String.Format("{0}{0}", Path.DirectorySeparatorChar)))
- {
- // This is the case 1: "\\server\folder"
- absoluteOutputPath = outputPath;
- }
- else if (outputPath.Length >= 2 && outputPath[1] == Path.VolumeSeparatorChar)
- {
- // This is the case 2: "drive:\folder"
- absoluteOutputPath = outputPath;
- }
- else if (outputPath.IndexOf("..\\") != -1)
- {
- // This is the case 3: "..\..\folder"
- projectFolder = Path.GetDirectoryName(project.FullName);
- while (outputPath.StartsWith("..\\"))
- {
- outputPath = outputPath.Substring(3);
- projectFolder = Path.GetDirectoryName(projectFolder);
- }
-
- absoluteOutputPath = System.IO.Path.Combine(projectFolder, outputPath);
- }
- else
- {
- // This is the case 4: "folder"
- projectFolder = System.IO.Path.GetDirectoryName(project.FullName);
- absoluteOutputPath = System.IO.Path.Combine(projectFolder, outputPath);
- }
-
- return Path.Combine(absoluteOutputPath, project.Properties.Item("OutputFileName").Value.ToString());
- }
-
- internal static string GetIcon(TestExecutionStatus status)
- {
- string icon = "Resources/{0}";
-
- switch (status)
- {
- case TestExecutionStatus.NotRun:
- return string.Format(icon, "NotRun.png");
- case TestExecutionStatus.Successful:
- return string.Format(icon, "Successful.png");
- case TestExecutionStatus.Error:
- return string.Format(icon, "Failed.png");
- case TestExecutionStatus.Inconclusive:
- return string.Format(icon, "Inconclusive.png");
- default:
- return string.Format(icon, "NotRun.png");
- }
- }
-
- ///
- /// Returns the property value .
- ///
- /// Generic Type for value of the property
- /// The object.
- /// Name of the property.
- /// Value of the property as T
- private static T GetPropertyValue(Object obj, string propertyName) where T : class
- {
- return obj.GetType().GetProperty(propertyName).GetValue(obj) as T;
- }
-
-
- ///
- /// Returns the document file name of the text view.
- ///
- /// The view instance.
- ///
- internal static string GetFileName(ITextView view)
- {
- ITextBuffer TextBuffer = view.TextBuffer;
-
- ITextDocument TextDocument = GetTextDocument(TextBuffer);
-
- if (TextDocument == null || TextDocument.FilePath == null || TextDocument.FilePath.Equals("Temp.txt"))
- {
- return null;
- }
-
- return TextDocument.FilePath;
- }
-
- ///
- /// Retrives the ITextDocument from the text buffer.
- ///
- /// The text buffer instance.
- ///
- private static ITextDocument GetTextDocument(ITextBuffer TextBuffer)
- {
- if (TextBuffer == null)
- return null;
-
- ITextDocument textDoc;
- var rc = TextBuffer.Properties.TryGetProperty(typeof(ITextDocument), out textDoc);
-
- if (rc == true)
- return textDoc;
- else
- return null;
- }
-
- /// Given an IWpfTextViewHost representing the currently selected editor pane,
- /// return the ITextDocument for that view. That's useful for learning things
- /// like the filename of the document, its creation date, and so on.
- internal static ITextDocument GetTextDocumentForView(IWpfTextViewHost viewHost)
- {
- ITextDocument document;
- viewHost.TextView.TextDataModel.DocumentBuffer.Properties.TryGetProperty(typeof(ITextDocument), out document);
- return document;
- }
-
- /////
- ///// Refreshes/Repaints the active file in Visual Studio.
- /////
- //internal static void RefreshActiveDocument(EnvDTE.DTE DTE)
- //{
- // try
- // {
- // IWpfTextViewHost host = OpenCoverUIPackage.Instance.GetCurrentViewHost();
- // if (host != null)
- // {
- // var doc = GetTextDocumentForView(host);
- // doc.UpdateDirtyState(true, DateTime.Now);
- // }
-
- // }
- // catch (Exception ex)
- // {
- // Debug.WriteLine(ex.Message);
- // }
- //}
-
-
- }
+ internal static class IDEHelper
+ {
+ private const string BASE_IMAGE_PREFIX = "/OpenCover.UI;component/";
+
+ private static IVsOutputWindow _outputWindow;
+ private static IVsOutputWindowPane _pane;
+ private static EnvDTE.DTE DTE;
+
+ ///
+ /// Initializes the class.
+ ///
+ static IDEHelper()
+ {
+ _outputWindow = Package.GetGlobalService(typeof(SVsOutputWindow)) as IVsOutputWindow;
+
+ Guid guidGeneral = VSConstants.OutputWindowPaneGuid.GeneralPane_guid;
+ int hr = _outputWindow.CreatePane(guidGeneral, "OpenCover", 1, 1);
+ hr = _outputWindow.GetPane(guidGeneral, out _pane);
+
+ DTE = (Package.GetGlobalService(typeof(EnvDTE.DTE))) as EnvDTE.DTE;
+ }
+
+ ///
+ /// Opens the file in Visual Studio.
+ ///
+ /// The file path.
+ internal static void OpenFile(EnvDTE.DTE DTE, string file)
+ {
+ try
+ {
+ if (System.IO.File.Exists(file))
+ {
+ DTE.ItemOperations.OpenFile(file);
+ }
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine(ex.Message);
+ }
+ }
+
+ ///
+ /// Closes the file.
+ ///
+ /// The DTE.
+ /// Name of the file.
+ internal static void CloseFile(EnvDTE.DTE DTE, string fileName)
+ {
+ foreach (EnvDTE.Document document in DTE.Documents)
+ {
+ if (fileName.Equals(document.FullName, StringComparison.InvariantCultureIgnoreCase))
+ {
+ document.Close();
+ break;
+ }
+ }
+ }
+
+ ///
+ /// Moves the caret to line number.
+ ///
+ /// The DTE.
+ /// The line number.
+ internal static void GoToLine(EnvDTE.DTE DTE, int lineNumber)
+ {
+ DTE.ExecuteCommand("GotoLn", lineNumber.ToString());
+ }
+
+ ///
+ /// Writes to the output window.
+ ///
+ /// The message.
+ internal static void WriteToOutputWindow(string message)
+ {
+ try
+ {
+ if (_pane != null)
+ {
+ _pane.OutputStringThreadSafe(message);
+ _pane.OutputStringThreadSafe(Environment.NewLine);
+ }
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(String.Format("{0}\n{1}", ex.Message, ex.StackTrace), Resources.MessageBoxTitle, MessageBoxButton.OK);
+ }
+ }
+
+ ///
+ /// Writes to output window.
+ ///
+ /// The string format.
+ /// The arguments to formatting.
+ internal static void WriteToOutputWindow(string format, params object[] arguments)
+ {
+ WriteToOutputWindow(String.Format(format, arguments));
+ }
+
+
+ ///
+ /// Finds all the dlls in the project with reference to UnitTestFramework.dll
+ ///
+ /// List of all dlls which might contain tests
+ internal static IEnumerable GetPotentialTestDLLs()
+ {
+ string mstestPath = "Microsoft.VisualStudio.TestPlatform.TestFramework.dll";
+ string nunitPath = "nunit.Framework.dll";
+ string xunitPath = "xunit.core.dll";
+
+ List projects = new List();
+
+ GetProjects(DTE.Solution.Projects, projects);
+
+ foreach (var currentProject in projects)
+ {
+ var vsProject2 = currentProject.Object as VSProject2;
+ bool isTestProject = false;
+
+ if (vsProject2 != null)
+ {
+ foreach (Reference reference in vsProject2.References)
+ {
+ var referenceFile = Path.GetFileName(reference.Path);
+ if (mstestPath.Equals(referenceFile, StringComparison.InvariantCultureIgnoreCase)
+ || nunitPath.Equals(referenceFile, StringComparison.InvariantCultureIgnoreCase)
+ || xunitPath.Equals(referenceFile, StringComparison.InvariantCultureIgnoreCase))
+ {
+ isTestProject = true;
+ break;
+ }
+ }
+
+ if (isTestProject)
+ {
+ yield return GetOutputPath(currentProject);
+ }
+ }
+ }
+
+ }
+
+ ///
+ /// Search for a class + method in the opened solution. When found, the corresponding file will
+ /// be opened, and the specified method will be shown.
+ ///
+ /// Fully qualified method to search for.
+ internal static void OpenFileByFullyQualifiedMethodName(string fullyQualifiedMethodName)
+ {
+ List projects = new List();
+
+ GetProjects(DTE.Solution.Projects, projects);
+
+ foreach (EnvDTE.Project project in projects)
+ {
+ var projectItems = project.ProjectItems;
+ var found = ScanProjectItems(fullyQualifiedMethodName, projectItems);
+ if (found)
+ {
+ if (Debugger.IsAttached)
+ {
+ WriteToOutputWindow("Method found, stopping solution search");
+ }
+
+ return;
+ }
+ }
+
+ WriteToOutputWindow("Could not find method '{0}' in the current solution", fullyQualifiedMethodName);
+ }
+
+ private static bool ScanProjectItems(string fullyQualifiedMethodName, EnvDTE.ProjectItems projectItems)
+ {
+ foreach (EnvDTE.ProjectItem projectItem in projectItems)
+ {
+ if (Debugger.IsAttached)
+ {
+ WriteToOutputWindow("Processing projectItem: {0}", projectItem.Name);
+ }
+
+ if (projectItem.FileCodeModel != null)
+ {
+ var codeModel = (EnvDTE.FileCodeModel)projectItem.FileCodeModel;
+ foreach (EnvDTE.CodeElement codeElement in codeModel.CodeElements)
+ {
+ EnvDTE.CodeElement discoveredMethodElement;
+ if (FindMethodInCodeElement(codeElement, fullyQualifiedMethodName, out discoveredMethodElement))
+ {
+ var filepath = (string)projectItem.Properties.Item("FullPath").Value;
+
+ WriteToOutputWindow("Method '{0}' found, opening file: '{1}'", fullyQualifiedMethodName, filepath);
+ OpenFile(DTE, filepath);
+
+ int methodStartLine = discoveredMethodElement.StartPoint.Line;
+ WriteToOutputWindow("Moving to method on line: {0}", methodStartLine);
+ GoToLine(DTE, discoveredMethodElement.StartPoint.Line);
+ return true;
+ }
+ }
+ }
+ else if (projectItem.Kind == EnvDTE.Constants.vsProjectItemKindPhysicalFolder)
+ {
+ if (Debugger.IsAttached)
+ {
+ WriteToOutputWindow("Scanning subfolder: {0}", projectItem.Name);
+ }
+
+ var found = ScanProjectItems(fullyQualifiedMethodName, projectItem.ProjectItems);
+ if (found)
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ private static bool FindMethodInCodeElement(EnvDTE.CodeElement codeElement, string fullyQualifiedMethodName,
+ out EnvDTE.CodeElement discoveredMethodElement)
+ {
+ if (codeElement.Kind == EnvDTE.vsCMElement.vsCMElementClass)
+ {
+ if (Debugger.IsAttached)
+ {
+ WriteToOutputWindow("Processing class: {0}", codeElement.FullName);
+ }
+
+ foreach (EnvDTE.CodeElement classChildCodeElement in codeElement.Children)
+ {
+ if (classChildCodeElement.Kind == EnvDTE.vsCMElement.vsCMElementFunction)
+ {
+ if (fullyQualifiedMethodName == classChildCodeElement.FullName)
+ {
+ discoveredMethodElement = classChildCodeElement;
+ return true;
+ }
+ }
+ }
+ }
+
+ foreach (EnvDTE.CodeElement childElement in codeElement.Children)
+ {
+ if (FindMethodInCodeElement(childElement, fullyQualifiedMethodName, out discoveredMethodElement))
+ {
+ return true;
+ }
+ }
+
+ discoveredMethodElement = null;
+ return false;
+ }
+
+ private static void GetProjects(EnvDTE.Projects projects, List projectList)
+ {
+ foreach (EnvDTE.Project project in projects)
+ GetProjects(project, projectList);
+ }
+
+ private static void GetProjects(EnvDTE.Project project, List projectList)
+ {
+ if (project == null)
+ return;
+
+ if (project.Kind.Contains("FAE04EC0-301F-11D3-BF4B-00C04F79EFBC") || project.Kind.Contains("F184B08F-C81C-45F6-A57F-5ABD9991F28F"))
+ projectList.Add(project);
+
+ if (project.ProjectItems == null || project.ProjectItems.Count == 0)
+ return;
+
+ foreach (EnvDTE.ProjectItem proj in project.ProjectItems)
+ {
+ var DTEProject = proj.Object as EnvDTE.Project;
+ if (DTEProject != null)
+ GetProjects(DTEProject, projectList);
+ }
+ }
+
+ internal static string GetImageURL(string url)
+ {
+ return String.Format("{0}{1}", BASE_IMAGE_PREFIX, url);
+ }
+
+ ///
+ /// Returns the output path of the project.
+ ///
+ /// The project.
+ /// Output path
+ internal static string GetOutputPath(EnvDTE.Project project)
+ {
+ string outputPath = project.ConfigurationManager != null && project.ConfigurationManager.ActiveConfiguration != null
+ ? project.ConfigurationManager.ActiveConfiguration.Properties.Item("OutputPath").Value.ToString() : null;
+
+ if (outputPath == null)
+ {
+ return null;
+ }
+
+ string absoluteOutputPath;
+ string projectFolder;
+
+ if (outputPath.StartsWith(String.Format("{0}{0}", Path.DirectorySeparatorChar)))
+ {
+ // This is the case 1: "\\server\folder"
+ absoluteOutputPath = outputPath;
+ }
+ else if (outputPath.Length >= 2 && outputPath[1] == Path.VolumeSeparatorChar)
+ {
+ // This is the case 2: "drive:\folder"
+ absoluteOutputPath = outputPath;
+ }
+ else if (outputPath.IndexOf("..\\") != -1)
+ {
+ // This is the case 3: "..\..\folder"
+ projectFolder = Path.GetDirectoryName(project.FullName);
+ while (outputPath.StartsWith("..\\"))
+ {
+ outputPath = outputPath.Substring(3);
+ projectFolder = Path.GetDirectoryName(projectFolder);
+ }
+
+ absoluteOutputPath = System.IO.Path.Combine(projectFolder, outputPath);
+ }
+ else
+ {
+ // This is the case 4: "folder"
+ projectFolder = System.IO.Path.GetDirectoryName(project.FullName);
+ absoluteOutputPath = System.IO.Path.Combine(projectFolder, outputPath);
+ }
+
+ return Path.Combine(absoluteOutputPath, project.Properties.Item("OutputFileName").Value.ToString());
+ }
+
+ internal static string GetIcon(TestExecutionStatus status)
+ {
+ string icon = "Resources/{0}";
+
+ switch (status)
+ {
+ case TestExecutionStatus.NotRun:
+ return string.Format(icon, "NotRun.png");
+ case TestExecutionStatus.Successful:
+ return string.Format(icon, "Successful.png");
+ case TestExecutionStatus.Error:
+ return string.Format(icon, "Failed.png");
+ case TestExecutionStatus.Inconclusive:
+ return string.Format(icon, "Inconclusive.png");
+ default:
+ return string.Format(icon, "NotRun.png");
+ }
+ }
+
+ ///
+ /// Returns the property value .
+ ///
+ /// Generic Type for value of the property
+ /// The object.
+ /// Name of the property.
+ /// Value of the property as T
+ private static T GetPropertyValue(Object obj, string propertyName) where T : class
+ {
+ return obj.GetType().GetProperty(propertyName).GetValue(obj) as T;
+ }
+
+
+ ///
+ /// Returns the document file name of the text view.
+ ///
+ /// The view instance.
+ ///
+ internal static string GetFileName(ITextView view)
+ {
+ ITextBuffer TextBuffer = view.TextBuffer;
+
+ ITextDocument TextDocument = GetTextDocument(TextBuffer);
+
+ if (TextDocument == null || TextDocument.FilePath == null || TextDocument.FilePath.Equals("Temp.txt"))
+ {
+ return null;
+ }
+
+ return TextDocument.FilePath;
+ }
+
+ ///
+ /// Retrives the ITextDocument from the text buffer.
+ ///
+ /// The text buffer instance.
+ ///
+ private static ITextDocument GetTextDocument(ITextBuffer TextBuffer)
+ {
+ if (TextBuffer == null)
+ return null;
+
+ ITextDocument textDoc;
+ var rc = TextBuffer.Properties.TryGetProperty(typeof(ITextDocument), out textDoc);
+
+ if (rc == true)
+ return textDoc;
+ else
+ return null;
+ }
+
+ /// Given an IWpfTextViewHost representing the currently selected editor pane,
+ /// return the ITextDocument for that view. That's useful for learning things
+ /// like the filename of the document, its creation date, and so on.
+ internal static ITextDocument GetTextDocumentForView(IWpfTextViewHost viewHost)
+ {
+ ITextDocument document;
+ viewHost.TextView.TextDataModel.DocumentBuffer.Properties.TryGetProperty(typeof(ITextDocument), out document);
+ return document;
+ }
+
+ /////
+ ///// Refreshes/Repaints the active file in Visual Studio.
+ /////
+ //internal static void RefreshActiveDocument(EnvDTE.DTE DTE)
+ //{
+ // try
+ // {
+ // IWpfTextViewHost host = OpenCoverUIPackage.Instance.GetCurrentViewHost();
+ // if (host != null)
+ // {
+ // var doc = GetTextDocumentForView(host);
+ // doc.UpdateDirtyState(true, DateTime.Now);
+ // }
+
+ // }
+ // catch (Exception ex)
+ // {
+ // Debug.WriteLine(ex.Message);
+ // }
+ //}
+
+
+ }
}
diff --git a/OpenCover.UI/OpenCover.UI.csproj b/OpenCover.UI/OpenCover.UI.csproj
index b89081a..fba56d8 100644
--- a/OpenCover.UI/OpenCover.UI.csproj
+++ b/OpenCover.UI/OpenCover.UI.csproj
@@ -1,7 +1,7 @@
- 14.0
+ 15.0
11.0
$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
@@ -11,6 +11,9 @@
12.0
..\
true
+
+
+
@@ -25,7 +28,7 @@
OpenCover.UI
True
Key.snk
- v4.5
+ v4.6
Program
@@ -67,30 +70,88 @@
..\packages\CommonServiceLocator.1.3\lib\portable-net4+sl5+netcore45+wpa81+wp8\Microsoft.Practices.ServiceLocation.dll
-
- False
- C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\Editor\Microsoft.VisualStudio.CoreUtility.dll
+
+ ..\packages\Microsoft.VisualStudio.CoreUtility.15.6.27740\lib\net46\Microsoft.VisualStudio.CoreUtility.dll
+ True
+
+
+ ..\packages\Microsoft.VisualStudio.ImageCatalog.15.7.27703\lib\net45\Microsoft.VisualStudio.ImageCatalog.dll
+ True
+
+
+ ..\packages\Microsoft.VisualStudio.Imaging.15.7.27703\lib\net45\Microsoft.VisualStudio.Imaging.dll
+ True
+
+
+ True
+ ..\packages\Microsoft.VisualStudio.Imaging.Interop.14.0.DesignTime.14.3.26930\lib\net20\Microsoft.VisualStudio.Imaging.Interop.14.0.DesignTime.dll
+ True
+
+
+ ..\packages\Microsoft.VisualStudio.OLE.Interop.7.10.6071\lib\Microsoft.VisualStudio.OLE.Interop.dll
+ True
-
False
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Microsoft.VisualStudio.Platform.WindowManagement.dll
-
-
-
-
-
- true
+
+ ..\packages\Microsoft.VisualStudio.Shell.15.0.15.7.27703\lib\net45\Microsoft.VisualStudio.Shell.15.0.dll
+ True
+
+
+ ..\packages\Microsoft.VisualStudio.Shell.Framework.15.7.27703\lib\net45\Microsoft.VisualStudio.Shell.Framework.dll
+ True
+
+
+ ..\packages\Microsoft.VisualStudio.Shell.Interop.7.10.6072\lib\net11\Microsoft.VisualStudio.Shell.Interop.dll
+ True
+
+
+ True
+ ..\packages\Microsoft.VisualStudio.Shell.Interop.10.0.10.0.30320\lib\net20\Microsoft.VisualStudio.Shell.Interop.10.0.dll
+ True
+
+
+ True
+ ..\packages\Microsoft.VisualStudio.Shell.Interop.11.0.11.0.61031\lib\net20\Microsoft.VisualStudio.Shell.Interop.11.0.dll
+ True
+
+
+ True
+ ..\packages\Microsoft.VisualStudio.Shell.Interop.12.0.12.0.30111\lib\net20\Microsoft.VisualStudio.Shell.Interop.12.0.dll
+ True
+
+
+ True
+ ..\packages\Microsoft.VisualStudio.Shell.Interop.14.0.DesignTime.14.3.26929\lib\net20\Microsoft.VisualStudio.Shell.Interop.14.0.DesignTime.dll
+ True
+
+
+ True
+ ..\packages\Microsoft.VisualStudio.Shell.Interop.15.3.DesignTime.15.0.26929\lib\net20\Microsoft.VisualStudio.Shell.Interop.15.3.DesignTime.dll
+ True
+
+
+ ..\packages\Microsoft.VisualStudio.Shell.Interop.15.6.DesignTime.15.6.27413\lib\net20\Microsoft.VisualStudio.Shell.Interop.15.6.DesignTime.dll
+ True
+
+
+ ..\packages\Microsoft.VisualStudio.Shell.Interop.8.0.8.0.50728\lib\net11\Microsoft.VisualStudio.Shell.Interop.8.0.dll
+ True
+
+
+ ..\packages\Microsoft.VisualStudio.Shell.Interop.9.0.9.0.30730\lib\net11\Microsoft.VisualStudio.Shell.Interop.9.0.dll
+ True
False
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Microsoft.VisualStudio.Shell.ViewManager.dll
-
- False
- C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\Editor\Microsoft.VisualStudio.Text.Data.dll
+
+ ..\packages\Microsoft.VisualStudio.Text.Data.15.6.27740\lib\net46\Microsoft.VisualStudio.Text.Data.dll
+ True
False
@@ -104,10 +165,34 @@
False
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\Editor\Microsoft.VisualStudio.Text.UI.Wpf.dll
-
+
+ ..\packages\Microsoft.VisualStudio.TextManager.Interop.7.10.6071\lib\net11\Microsoft.VisualStudio.TextManager.Interop.dll
+ True
+
+
+ ..\packages\Microsoft.VisualStudio.TextManager.Interop.8.0.8.0.50728\lib\net11\Microsoft.VisualStudio.TextManager.Interop.8.0.dll
+ True
+
+
+ ..\packages\Microsoft.VisualStudio.Threading.15.6.31\lib\net46\Microsoft.VisualStudio.Threading.dll
+
+
+ ..\packages\Microsoft.VisualStudio.Utilities.15.7.27703\lib\net46\Microsoft.VisualStudio.Utilities.dll
+ True
+
+
+ ..\packages\Microsoft.VisualStudio.Validation.15.3.15\lib\net45\Microsoft.VisualStudio.Validation.dll
+ True
+
+
+ ..\packages\Newtonsoft.Json.6.0.6\lib\net45\Newtonsoft.Json.dll
+
+
+ ..\packages\StreamJsonRpc.1.3.23\lib\net45\StreamJsonRpc.dll
+
@@ -115,6 +200,7 @@
+
@@ -376,11 +462,21 @@
OpenCover.UI.TestDiscoverer
+
+
+
true
+
+
+
+ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
+
+
+
+
+
+
+ true
+
+
+
+
\ No newline at end of file
diff --git a/packages/xunit.core.2.1.0/build/_desktop/xunit.execution.desktop.dll b/packages/xunit.core.2.1.0/build/_desktop/xunit.execution.desktop.dll
new file mode 100644
index 0000000..e5ca3bf
Binary files /dev/null and b/packages/xunit.core.2.1.0/build/_desktop/xunit.execution.desktop.dll differ
diff --git a/packages/xunit.core.2.1.0/build/dnx451/_._ b/packages/xunit.core.2.1.0/build/dnx451/_._
new file mode 100644
index 0000000..e69de29
diff --git a/packages/xunit.core.2.1.0/build/monoandroid/_._ b/packages/xunit.core.2.1.0/build/monoandroid/_._
new file mode 100644
index 0000000..e69de29
diff --git a/packages/xunit.core.2.1.0/build/monotouch/_._ b/packages/xunit.core.2.1.0/build/monotouch/_._
new file mode 100644
index 0000000..e69de29
diff --git a/packages/xunit.core.2.1.0/build/net45/_._ b/packages/xunit.core.2.1.0/build/net45/_._
new file mode 100644
index 0000000..e69de29
diff --git a/packages/xunit.core.2.1.0/build/portable-net45+win8+wp8+wpa81/xunit.core.props b/packages/xunit.core.2.1.0/build/portable-net45+win8+wp8+wpa81/xunit.core.props
new file mode 100644
index 0000000..a00a545
--- /dev/null
+++ b/packages/xunit.core.2.1.0/build/portable-net45+win8+wp8+wpa81/xunit.core.props
@@ -0,0 +1,10 @@
+
+
+
+
+ xunit.execution.desktop.dll
+ PreserveNewest
+ False
+
+
+
\ No newline at end of file
diff --git a/packages/xunit.core.2.1.0/build/win8/_._ b/packages/xunit.core.2.1.0/build/win8/_._
new file mode 100644
index 0000000..e69de29
diff --git a/packages/xunit.core.2.1.0/build/win81/xunit.core.props b/packages/xunit.core.2.1.0/build/win81/xunit.core.props
new file mode 100644
index 0000000..a00a545
--- /dev/null
+++ b/packages/xunit.core.2.1.0/build/win81/xunit.core.props
@@ -0,0 +1,10 @@
+
+
+
+
+ xunit.execution.desktop.dll
+ PreserveNewest
+ False
+
+
+
\ No newline at end of file
diff --git a/packages/xunit.core.2.1.0/build/wp8/_._ b/packages/xunit.core.2.1.0/build/wp8/_._
new file mode 100644
index 0000000..e69de29
diff --git a/packages/xunit.core.2.1.0/build/wpa81/xunit.core.props b/packages/xunit.core.2.1.0/build/wpa81/xunit.core.props
new file mode 100644
index 0000000..a00a545
--- /dev/null
+++ b/packages/xunit.core.2.1.0/build/wpa81/xunit.core.props
@@ -0,0 +1,10 @@
+
+
+
+
+ xunit.execution.desktop.dll
+ PreserveNewest
+ False
+
+
+
\ No newline at end of file
diff --git a/packages/xunit.core.2.1.0/build/xamarinios/_._ b/packages/xunit.core.2.1.0/build/xamarinios/_._
new file mode 100644
index 0000000..e69de29