Skip to content

Commit

Permalink
#431: ValueTask defined in xunit.runner.visualstudio causing conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
bradwilson committed Dec 21, 2024
1 parent 0a250fc commit 8f3a586
Show file tree
Hide file tree
Showing 19 changed files with 52 additions and 26 deletions.
2 changes: 1 addition & 1 deletion src/xunit.runner.visualstudio/Constants.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Xunit.Runner.VisualStudio;

public static class Constants
internal static class Constants
{
#if NETFRAMEWORK
public const string ExecutorUri = "executor://xunit/VsTestRunner3/netfx/";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Xunit.Runner.VisualStudio;

public class DiagnosticMessageSink : DiagnosticEventSink
internal class DiagnosticMessageSink : DiagnosticEventSink
{
public DiagnosticMessageSink(
LoggerHelper log,
Expand Down
2 changes: 1 addition & 1 deletion src/xunit.runner.visualstudio/Sinks/VsDiscoverySink.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

namespace Xunit.Runner.VisualStudio;

public sealed class VsDiscoverySink : IVsDiscoverySink, IDisposable
internal sealed class VsDiscoverySink : IVsDiscoverySink, IDisposable
{
static readonly string Ellipsis = new((char)183, 3);
const int MaximumDisplayNameLength = 447;
Expand Down
2 changes: 1 addition & 1 deletion src/xunit.runner.visualstudio/Sinks/VsExecutionSink.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

namespace Xunit.Runner.VisualStudio;

public sealed class VsExecutionSink : TestMessageSink, IDisposable
internal sealed class VsExecutionSink : TestMessageSink, IDisposable
{
readonly Func<bool> cancelledThunk;
readonly LoggerHelper logger;
Expand Down
2 changes: 1 addition & 1 deletion src/xunit.runner.visualstudio/TestPlatformContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace Xunit.Runner.VisualStudio;
/// Provides contextual information on a test run/discovery based on runsettings
/// or the invocation (execution, discovery).
/// </summary>
public struct TestPlatformContext
internal struct TestPlatformContext
{
/// <summary>
/// Indicates if the test runner is running in design mode (meaning, inside the Visual Studio IDE).
Expand Down
2 changes: 1 addition & 1 deletion src/xunit.runner.visualstudio/Utility/AssemblyRunInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace Xunit.Runner.VisualStudio;

public class AssemblyRunInfo
internal class AssemblyRunInfo
{
AssemblyRunInfo(
LoggerHelper logger,
Expand Down
2 changes: 1 addition & 1 deletion src/xunit.runner.visualstudio/Utility/LoggerHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Xunit.Runner.VisualStudio;

public class LoggerHelper(IMessageLogger? logger, Stopwatch stopwatch)
internal class LoggerHelper(IMessageLogger? logger, Stopwatch stopwatch)
{
public IMessageLogger? InnerLogger { get; private set; } = logger;

Expand Down
2 changes: 1 addition & 1 deletion src/xunit.runner.visualstudio/Utility/RunSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Xunit.Runner.VisualStudio;

public class RunSettings
internal class RunSettings
{
public AppDomainSupport? AppDomain { get; set; }
public string? Culture { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion src/xunit.runner.visualstudio/Utility/TestCaseFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace Xunit.Runner.VisualStudio;

public class TestCaseFilter
internal class TestCaseFilter
{
const string DisplayNameString = "DisplayName";
const string FullyQualifiedNameString = "FullyQualifiedName";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Xunit.Runner.VisualStudio;

public class VisualStudioRunnerLogger(LoggerHelper loggerHelper) :
internal class VisualStudioRunnerLogger(LoggerHelper loggerHelper) :
IRunnerLogger
{
static readonly object lockObject = new();
Expand Down
16 changes: 8 additions & 8 deletions src/xunit.runner.visualstudio/VsTestRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,22 +120,22 @@ public class VsTestRunner : ITestDiscoverer, ITestExecutor
"xunit.v3.runner.utility.netstandard20.dll",
};

public static TestProperty ManagedMethodProperty { get; } =
internal static TestProperty ManagedMethodProperty { get; } =
TestProperty.Register("TestCase.ManagedMethod", "ManagedMethod", string.Empty, string.Empty, typeof(string), x => !string.IsNullOrWhiteSpace(x as string), TestPropertyAttributes.Hidden, typeof(TestCase));

public static TestProperty ManagedTypeProperty { get; } =
internal static TestProperty ManagedTypeProperty { get; } =
TestProperty.Register("TestCase.ManagedType", "ManagedType", string.Empty, string.Empty, typeof(string), x => !string.IsNullOrWhiteSpace(x as string), TestPropertyAttributes.Hidden, typeof(TestCase));

public static TestProperty SkipReasonProperty { get; } =
internal static TestProperty SkipReasonProperty { get; } =
TestProperty.Register("XunitSkipReason", "xUnit.net Skip Reason", typeof(string), typeof(VsTestRunner));

public static TestProperty TestCaseExplicitProperty { get; } =
internal static TestProperty TestCaseExplicitProperty { get; } =
TestProperty.Register("XunitTestCaseExplicit", "xUnit.net Test Case Explicit Flag", typeof(bool), typeof(VsTestRunner));

public static TestProperty TestCaseSerializationProperty { get; } =
internal static TestProperty TestCaseSerializationProperty { get; } =
TestProperty.Register("XunitTestCaseSerialization", "xUnit.net Test Case Serialization", typeof(string), typeof(VsTestRunner));

public static TestProperty TestCaseUniqueIDProperty { get; } =
internal static TestProperty TestCaseUniqueIDProperty { get; } =
TestProperty.Register("XunitTestCaseUniqueID", "xUnit.net Test Case Unique ID", typeof(string), typeof(VsTestRunner));

public void Cancel() =>
Expand Down Expand Up @@ -307,7 +307,7 @@ async Task<bool> DiscoverTestsInAssembly<TVisitor>(
return true;
}

public static IReadOnlyList<IRunnerReporter> GetAvailableRunnerReporters(LoggerHelper? logger)
internal static IReadOnlyList<IRunnerReporter> GetAvailableRunnerReporters(LoggerHelper? logger)
{
var result = RegisteredRunnerReporters.Get(typeof(VsTestRunner).Assembly, out var messages);

Expand All @@ -318,7 +318,7 @@ public static IReadOnlyList<IRunnerReporter> GetAvailableRunnerReporters(LoggerH
return result;
}

public static IRunnerReporter GetRunnerReporter(
internal static IRunnerReporter GetRunnerReporter(
LoggerHelper? logger,
RunSettings runSettings)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

<ItemGroup>
<InternalsVisibleTo Include="test.xunit.runner.visualstudio" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="xunit.analyzers" Version="$(XunitAnalyzersVersion)" PrivateAssets="All" />
<PackageReference Include="xunit.v3.runner.utility" Version="$(XunitV3Version)" />
Expand Down
4 changes: 3 additions & 1 deletion test/test.xunit.runner.visualstudio/RunSettingsTests.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
extern alias VSTestAdapter;

using System;
using Xunit;
using Xunit.Runner.Common;
using Xunit.Runner.VisualStudio;
using Xunit.Sdk;
using RunSettings = VSTestAdapter.Xunit.Runner.VisualStudio.RunSettings;

public class RunSettingsTests
{
Expand Down
6 changes: 5 additions & 1 deletion test/test.xunit.runner.visualstudio/RunnerReporterTests.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
extern alias VSTestAdapter;

using System;
using System.Diagnostics;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging;
using NSubstitute;
using Xunit;
using Xunit.Runner.Common;
using Xunit.Runner.VisualStudio;
using LoggerHelper = VSTestAdapter.Xunit.Runner.VisualStudio.LoggerHelper;
using RunSettings = VSTestAdapter.Xunit.Runner.VisualStudio.RunSettings;
using VsTestRunner = VSTestAdapter.Xunit.Runner.VisualStudio.VsTestRunner;

public class RunnerReporterTests
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
extern alias VSTestAdapter;

using System;
using System.Collections.Generic;
using System.Linq;
using Xunit;
using Xunit.Runner.VisualStudio;
using Constants = VSTestAdapter.Xunit.Runner.VisualStudio.Constants;
using TestPlatformContext = VSTestAdapter.Xunit.Runner.VisualStudio.TestPlatformContext;
using VsDiscoverySink = VSTestAdapter.Xunit.Runner.VisualStudio.VsDiscoverySink;
using VsTestRunner = VSTestAdapter.Xunit.Runner.VisualStudio.VsTestRunner;

public class VsDiscoverySinkTests
{
Expand Down Expand Up @@ -45,7 +51,7 @@ public void StandardData(

Assert.NotNull(vsTestCase);

// Standard VSTest properties
// Standard VSTest propertiesgi
Assert.Equal("/source/file.cs", vsTestCase.CodeFilePath);
Assert.Equal("test-case-display-name", vsTestCase.DisplayName);
Assert.Equal(Constants.ExecutorUri, vsTestCase.ExecutorUri.OriginalString);
Expand Down
7 changes: 5 additions & 2 deletions test/test.xunit.runner.visualstudio/TestCaseFilterTests.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
extern alias VSTestAdapter;

using System;
using System.Collections.Generic;
using System.Diagnostics;
Expand All @@ -7,8 +9,9 @@
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging;
using NSubstitute;
using Xunit;
using Xunit.Runner.VisualStudio;
using Constants = Xunit.Runner.VisualStudio.Constants;
using Constants = VSTestAdapter.Xunit.Runner.VisualStudio.Constants;
using LoggerHelper = VSTestAdapter.Xunit.Runner.VisualStudio.LoggerHelper;
using TestCaseFilter = VSTestAdapter.Xunit.Runner.VisualStudio.TestCaseFilter;

public class TestCaseFilterTests
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
extern alias VSTestAdapter;

using System.Collections.Generic;
using System.Diagnostics;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging;
using LoggerHelper = VSTestAdapter.Xunit.Runner.VisualStudio.LoggerHelper;

namespace Xunit.Runner.VisualStudio;

public class SpyLoggerHelper(SpyMessageLogger logger, Stopwatch stopwatch) :
internal class SpyLoggerHelper(SpyMessageLogger logger, Stopwatch stopwatch) :
LoggerHelper(logger, stopwatch)
{
public IReadOnlyCollection<string> Messages => logger.Messages;
Expand Down
4 changes: 3 additions & 1 deletion test/test.xunit.runner.visualstudio/VsTestRunnerTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
extern alias VSTestAdapter;

using System.ComponentModel;
using System.Reflection;
using Xunit;
using Xunit.Runner.VisualStudio;
using VsTestRunner = VSTestAdapter.Xunit.Runner.VisualStudio.VsTestRunner;

public class VsTestRunnerTests
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\xunit.runner.visualstudio\xunit.runner.visualstudio.csproj" />
<ProjectReference Include="..\..\src\xunit.runner.visualstudio\xunit.runner.visualstudio.csproj">
<Aliases>VSTestAdapter</Aliases>
</ProjectReference>
</ItemGroup>

</Project>

0 comments on commit 8f3a586

Please sign in to comment.