diff --git a/src/CreateUnitTest.Xunit/CreateUnitTest.Xunit.csproj b/src/CreateUnitTest.Xunit/CreateUnitTest.Xunit.csproj
index fa5f6aa..98377da 100644
--- a/src/CreateUnitTest.Xunit/CreateUnitTest.Xunit.csproj
+++ b/src/CreateUnitTest.Xunit/CreateUnitTest.Xunit.csproj
@@ -69,9 +69,8 @@
-
-
+
diff --git a/src/CreateUnitTest.Xunit/XunitFrameworkProvider.cs b/src/CreateUnitTest.Xunit/XunitFrameworkProvider.cs
index 2fce343..72d79c1 100644
--- a/src/CreateUnitTest.Xunit/XunitFrameworkProvider.cs
+++ b/src/CreateUnitTest.Xunit/XunitFrameworkProvider.cs
@@ -10,7 +10,6 @@ namespace CreateUnitTest.Xunit
public abstract class XunitFrameworkProvider : FrameworkProviderBase
{
readonly string displayName;
- readonly string xunitCoreAssemblyVersionPrefix;
public XunitFrameworkProvider(IServiceProvider serviceProvider,
IConfigurationSettings configurationSettings,
@@ -18,30 +17,16 @@ public XunitFrameworkProvider(IServiceProvider serviceProvider,
IDirectory directory,
string displayName,
string xunitPackageVersion,
- string xunitCoreAssemblyVersionPrefix,
string visualStudioRunnerPackageVersion)
: base(new XunitSolutionManager(serviceProvider, naming, directory, xunitPackageVersion, visualStudioRunnerPackageVersion),
new XunitUnitTestProjectManager(serviceProvider, naming),
new XunitUnitTestClassManager(configurationSettings, naming))
{
this.displayName = displayName;
- this.xunitCoreAssemblyVersionPrefix = xunitCoreAssemblyVersionPrefix;
}
public override string AssemblyName => "xunit.core";
public override string Name => displayName;
-
- public override bool IsTestProject(Project project)
- {
- if (project == null)
- throw new ArgumentNullException("project");
-
- var vsProject2 = project.Object as VSProject2;
- if (vsProject2 != null && (project.Kind == ProjectTypes.CSharp || project.Kind == ProjectTypes.VisualBasic))
- return vsProject2.References.AsEnumerable().Any(r => r.Name == AssemblyName && r.Version.StartsWith(xunitCoreAssemblyVersionPrefix));
-
- return false;
- }
}
}
diff --git a/src/CreateUnitTest.Xunit/XunitFrameworkProvider_2_1.cs b/src/CreateUnitTest.Xunit/XunitFrameworkProvider_2_1.cs
deleted file mode 100644
index 9d9998b..0000000
--- a/src/CreateUnitTest.Xunit/XunitFrameworkProvider_2_1.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using System;
-using System.ComponentModel.Composition;
-using Microsoft.VisualStudio.TestPlatform.TestGeneration.Data;
-using Microsoft.VisualStudio.TestPlatform.TestGeneration.Model;
-
-namespace CreateUnitTest.Xunit
-{
- [Export(typeof(IFrameworkProvider))]
- public class XunitFrameworkProvider_2_1 : XunitFrameworkProvider
- {
- [ImportingConstructor]
- public XunitFrameworkProvider_2_1(IServiceProvider serviceProvider, IConfigurationSettings configurationSettings, INaming naming, IDirectory directory)
- : base(serviceProvider, configurationSettings, naming, directory,
- displayName: "xUnit.net 2.1",
- xunitPackageVersion: "2.1.0",
- xunitCoreAssemblyVersionPrefix: "2.1.0.",
- visualStudioRunnerPackageVersion: "2.1.0")
- { }
- }
-}
diff --git a/src/CreateUnitTest.Xunit/XunitFrameworkProvider_2_2.cs b/src/CreateUnitTest.Xunit/XunitFrameworkProvider_2_2.cs
index 9d8d45b..ac1d3e3 100644
--- a/src/CreateUnitTest.Xunit/XunitFrameworkProvider_2_2.cs
+++ b/src/CreateUnitTest.Xunit/XunitFrameworkProvider_2_2.cs
@@ -13,7 +13,6 @@ public XunitFrameworkProvider_2_2(IServiceProvider serviceProvider, IConfigurati
: base(serviceProvider, configurationSettings, naming, directory,
displayName: "xUnit.net 2.2",
xunitPackageVersion: "2.2.0",
- xunitCoreAssemblyVersionPrefix: "2.2.0.",
visualStudioRunnerPackageVersion: "2.2.0")
{ }
}
diff --git a/src/CreateUnitTest.Xunit/XunitFrameworkProvider_2_0.cs b/src/CreateUnitTest.Xunit/XunitFrameworkProvider_2_4.cs
similarity index 58%
rename from src/CreateUnitTest.Xunit/XunitFrameworkProvider_2_0.cs
rename to src/CreateUnitTest.Xunit/XunitFrameworkProvider_2_4.cs
index f0bd932..ed88f6b 100644
--- a/src/CreateUnitTest.Xunit/XunitFrameworkProvider_2_0.cs
+++ b/src/CreateUnitTest.Xunit/XunitFrameworkProvider_2_4.cs
@@ -6,15 +6,14 @@
namespace CreateUnitTest.Xunit
{
[Export(typeof(IFrameworkProvider))]
- public class XunitFrameworkProvider_2_0 : XunitFrameworkProvider
+ public class XunitFrameworkProvider_2_4 : XunitFrameworkProvider
{
[ImportingConstructor]
- public XunitFrameworkProvider_2_0(IServiceProvider serviceProvider, IConfigurationSettings configurationSettings, INaming naming, IDirectory directory)
+ public XunitFrameworkProvider_2_4(IServiceProvider serviceProvider, IConfigurationSettings configurationSettings, INaming naming, IDirectory directory)
: base(serviceProvider, configurationSettings, naming, directory,
- displayName: "xUnit.net 2.0",
- xunitPackageVersion: "2.0.0",
- xunitCoreAssemblyVersionPrefix: "2.0.0.",
- visualStudioRunnerPackageVersion: "2.1.0")
+ displayName: "xUnit.net 2.4",
+ xunitPackageVersion: "2.4.1",
+ visualStudioRunnerPackageVersion: "2.4.1")
{ }
}
}
diff --git a/src/CreateUnitTest.Xunit/XunitSolutionManager.cs b/src/CreateUnitTest.Xunit/XunitSolutionManager.cs
index 5ca05b1..e8eb32e 100644
--- a/src/CreateUnitTest.Xunit/XunitSolutionManager.cs
+++ b/src/CreateUnitTest.Xunit/XunitSolutionManager.cs
@@ -3,24 +3,19 @@
using System.Linq;
using EnvDTE;
using EnvDTE80;
-using Microsoft.VisualStudio.Shell.Interop;
+using Microsoft.VisualStudio.TestPlatform.TestGeneration;
using Microsoft.VisualStudio.TestPlatform.TestGeneration.Data;
using Microsoft.VisualStudio.TestPlatform.TestGeneration.Logging;
using Microsoft.VisualStudio.TestPlatform.TestGeneration.Model;
+using VSLangProj80;
namespace CreateUnitTest.Xunit
{
public class XunitSolutionManager : SolutionManagerBase
{
- readonly IServiceProvider serviceProvider;
- readonly Solution2 solution;
readonly string visualStudioRunnerPackageVersion;
readonly string xunitPackageVersion;
- static readonly Guid GUID_UniversalWindows = new Guid("{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A}");
- static readonly Guid GUID_WindowsPhoneApp81 = new Guid("{76F1466A-8B6D-4E39-A767-685A06062A39}");
- static readonly Guid GUID_WindowsStore81 = new Guid("{BC8A1FFA-BEE3-4634-8014-F334798102B3}");
-
public XunitSolutionManager(IServiceProvider serviceProvider,
INaming naming,
IDirectory directory,
@@ -28,12 +23,8 @@ public XunitSolutionManager(IServiceProvider serviceProvider,
string visualStudioRunnerPackageVersion)
: base(serviceProvider, naming, directory)
{
- this.serviceProvider = serviceProvider;
this.xunitPackageVersion = xunitPackageVersion;
this.visualStudioRunnerPackageVersion = visualStudioRunnerPackageVersion;
-
- var dte = (DTE)this.serviceProvider.GetService(typeof(SDTE));
- solution = (Solution2)dte.Solution;
}
protected override void OnUnitTestProjectCreated(Project unitTestProject, CodeFunction2 sourceMethod)
@@ -43,10 +34,8 @@ protected override void OnUnitTestProjectCreated(Project unitTestProject, CodeFu
if (sourceMethod == null)
throw new ArgumentNullException("sourceMethod");
- // TODO: Remove references to "MSTestFramework" and "MSTestFramework.Universal"
-
// Add package reference for xUnit.net
- TraceLogger.LogInfo("XunitSolutionManager.OnUnitTestProjectCreated: Adding reference to NuGet packages 'xunit' and 'xunit.runner.visualstudion' (version {0})", xunitPackageVersion);
+ TraceLogger.LogInfo("XunitSolutionManager.OnUnitTestProjectCreated: Adding reference to NuGet packages 'xunit {0}' and 'xunit.runner.visualstudio {1}'", xunitPackageVersion, visualStudioRunnerPackageVersion);
EnsureNuGetReference(unitTestProject, "xunit", xunitPackageVersion);
EnsureNuGetReference(unitTestProject, "xunit.runner.visualstudio", visualStudioRunnerPackageVersion);
@@ -60,25 +49,14 @@ protected override void OnUnitTestProjectCreated(Project unitTestProject, CodeFu
projectItem.Delete();
}
}
- }
- protected override string UnitTestProjectTemplatePath(Project sourceProject)
- {
- string templateName;
- var projectLanguage = VisualStudioHelper.GetProjectLanguage(sourceProject);
- var isCSharp = projectLanguage == "CSharp";
-
- var projectTypeGuids = sourceProject.ProjectTypeGuids(serviceProvider).ToList();
- if (projectTypeGuids.Contains(GUID_WindowsStore81))
- templateName = isCSharp ? "Microsoft.CS.WinRT.UnitTestLibrary" : "Microsoft.VisualBasic.WinRT.UnitTestLibrary";
- else if (isCSharp && projectTypeGuids.Contains(GUID_WindowsPhoneApp81)) // No VB template for WPA81, have to fall back to a class library
- templateName = "Microsoft.CS.WindowsPhoneApp.UnitTestApp";
- else if (projectTypeGuids.Contains(GUID_UniversalWindows))
- templateName = isCSharp ? "Microsoft.CSharp.UAP.UnitTestProject" : "Microsoft.VisualBasic.UAP.UnitTestProject";
- else
- templateName = isCSharp ? "Microsoft.CSharp.ClassLibrary" : "Microsoft.VisualBasic.Windows.ClassLibrary";
-
- return solution.GetProjectTemplate(templateName, projectLanguage);
+ var vsp = unitTestProject.Object as VSProject2;
+ var reference = vsp?.References.Find(GlobalConstants.MSTestAssemblyName);
+ if (reference != null)
+ {
+ TraceLogger.LogInfo("NUnitSolutionManager.OnUnitTestProjectCreated: Removing reference to {0}", reference.Name);
+ reference.Remove();
+ }
}
}
}
diff --git a/src/Package/source.extension.vsixmanifest b/src/Package/source.extension.vsixmanifest
index 51e9693..e97a023 100644
--- a/src/Package/source.extension.vsixmanifest
+++ b/src/Package/source.extension.vsixmanifest
@@ -9,7 +9,7 @@
logo-512-transparent.png
-
+
@@ -18,4 +18,7 @@
+
+
+