From 9645975483a8294d01f899a0d574e449a9ac24e0 Mon Sep 17 00:00:00 2001 From: Russ Cam Date: Tue, 27 Jun 2017 16:10:56 +1000 Subject: [PATCH 1/2] Runnable xunit tests with Resharper Visual Studio 2017 RTM and Resharper unit test runner are currently broken: https://youtrack.jetbrains.com/issue/RSRP-464233 This fix allows xunit tests to be runnable within Visual Studio by adding references to the following packages: A consequence of doing this is that Microsoft.NET.Test.Sdk defines a Main entry point which means that Tests project cannot define one. Main renamed to TestMain until this is resolved. --- src/Tests/Program.cs | 2 +- src/Tests/Tests.csproj | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Tests/Program.cs b/src/Tests/Program.cs index b6bed62f9cf..afeed8f0436 100644 --- a/src/Tests/Program.cs +++ b/src/Tests/Program.cs @@ -56,7 +56,7 @@ static Program() private static string SdkPath { get; } private static string OutputPath { get; } - public static void Main(string[] args) + public static void TestMain(string[] args) { if (args.Length == 0) Console.WriteLine("Must specify at least one argument: TestAssemblyPath, Profile or Benchmark "); diff --git a/src/Tests/Tests.csproj b/src/Tests/Tests.csproj index 47ee8d0a4ca..29000d23031 100644 --- a/src/Tests/Tests.csproj +++ b/src/Tests/Tests.csproj @@ -23,6 +23,7 @@ + @@ -30,7 +31,9 @@ - + + + From 2a48dc55d3c6011aedc3503858bb9cc162f1baae Mon Sep 17 00:00:00 2001 From: Russ Cam Date: Wed, 28 Jun 2017 11:59:20 +1000 Subject: [PATCH 2/2] Add comment for Main method rename in Tests project Following PR review --- src/Tests/Program.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Tests/Program.cs b/src/Tests/Program.cs index afeed8f0436..e36eed0e03f 100644 --- a/src/Tests/Program.cs +++ b/src/Tests/Program.cs @@ -56,6 +56,9 @@ static Program() private static string SdkPath { get; } private static string OutputPath { get; } + // TODO: Renamed this from Main to TestMain because of a bug with Resharper and running unit tests + // in Visual Studio with .NET Core: https://youtrack.jetbrains.com/issue/RSRP-464233 + // Once this is fixed, look at renaming back and removing additional packages. See https://github.com/elastic/elasticsearch-net/pull/2793 public static void TestMain(string[] args) { if (args.Length == 0)