Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove some un-used parameters #4283

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion samples/Playground/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public static async Task<int> Main(string[] args)
});
await discoveryResponse.WaitCompletionAsync();

ResponseListener runRequest = await client.RunTestsAsync(Guid.NewGuid(), testNodeUpdates.Select(x => x.Node).ToArray(), node => Task.CompletedTask);
ResponseListener runRequest = await client.RunTestsAsync(Guid.NewGuid(), testNodeUpdates.Select(x => x.Node).ToArray(), _ => Task.CompletedTask);
await runRequest.WaitCompletionAsync();

await client.ExitAsync();
Expand Down
4 changes: 2 additions & 2 deletions samples/Playground/ServerMode/TestingPlatformClientFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static async Task<TestingPlatformClient> StartAsServerAndConnectToTheClie
{
OnStandardOutput = (_, output) => builder.AppendLine(CultureInfo.InvariantCulture, $"OnStandardOutput:\n{output}"),
OnErrorOutput = (_, output) => builder.AppendLine(CultureInfo.InvariantCulture, $"OnErrorOutput:\n{output}"),
OnExit = (processHandle, exitCode) => builder.AppendLine(CultureInfo.InvariantCulture, $"OnExit: exit code '{exitCode}'"),
OnExit = (_, exitCode) => builder.AppendLine(CultureInfo.InvariantCulture, $"OnExit: exit code '{exitCode}'"),

Arguments = $"--server --client-host localhost --client-port {((IPEndPoint)tcpListener.LocalEndpoint).Port}",
// Arguments = $"--server --client-host localhost --client-port {((IPEndPoint)tcpListener.LocalEndpoint).Port} --diagnostic --diagnostic-verbosity trace",
Expand Down Expand Up @@ -173,7 +173,7 @@ public static IProcessHandle Start(ProcessConfiguration config, bool cleanDefaul

if (config.OnExit != null)
{
process.Exited += (s, e) => config.OnExit.Invoke(processHandle, process.ExitCode);
process.Exited += (_, _) => config.OnExit.Invoke(processHandle, process.ExitCode);
}

if (config.OnStandardOutput != null)
Expand Down
13 changes: 6 additions & 7 deletions src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,6 @@ private static void AddFixtureTests(TestMethodInfo testMethodInfo, List<UnitTest
{
string assemblyName = testMethodInfo.Parent.Parent.Assembly.GetName().Name!;
string assemblyLocation = testMethodInfo.Parent.Parent.Assembly.Location;
string className = testMethodInfo.Parent.ClassType.Name;
string classFullName = testMethodInfo.Parent.ClassType.FullName!;

// Check if fixtures for this assembly has already been added.
Expand All @@ -322,13 +321,13 @@ private static void AddFixtureTests(TestMethodInfo testMethodInfo, List<UnitTest
// Add AssemblyInitialize and AssemblyCleanup fixture tests if they exist.
if (testMethodInfo.Parent.Parent.AssemblyInitializeMethod is not null)
{
tests.Add(GetAssemblyFixtureTest(testMethodInfo.Parent.Parent.AssemblyInitializeMethod, assemblyName, className,
tests.Add(GetAssemblyFixtureTest(testMethodInfo.Parent.Parent.AssemblyInitializeMethod, assemblyName,
classFullName, assemblyLocation, Constants.AssemblyInitializeFixtureTrait));
}

if (testMethodInfo.Parent.Parent.AssemblyCleanupMethod is not null)
{
tests.Add(GetAssemblyFixtureTest(testMethodInfo.Parent.Parent.AssemblyCleanupMethod, assemblyName, className,
tests.Add(GetAssemblyFixtureTest(testMethodInfo.Parent.Parent.AssemblyCleanupMethod, assemblyName,
classFullName, assemblyLocation, Constants.AssemblyCleanupFixtureTrait));
}
}
Expand All @@ -341,26 +340,26 @@ private static void AddFixtureTests(TestMethodInfo testMethodInfo, List<UnitTest
// Add ClassInitialize and ClassCleanup fixture tests if they exist.
if (testMethodInfo.Parent.ClassInitializeMethod is not null)
{
tests.Add(GetClassFixtureTest(testMethodInfo.Parent.ClassInitializeMethod, assemblyName, className, classFullName,
tests.Add(GetClassFixtureTest(testMethodInfo.Parent.ClassInitializeMethod, classFullName,
assemblyLocation, Constants.ClassInitializeFixtureTrait));
}

if (testMethodInfo.Parent.ClassCleanupMethod is not null)
{
tests.Add(GetClassFixtureTest(testMethodInfo.Parent.ClassCleanupMethod, assemblyName, className, classFullName,
tests.Add(GetClassFixtureTest(testMethodInfo.Parent.ClassCleanupMethod, classFullName,
assemblyLocation, Constants.ClassCleanupFixtureTrait));
}
}

static UnitTestElement GetAssemblyFixtureTest(MethodInfo methodInfo, string assemblyName, string className, string classFullName,
static UnitTestElement GetAssemblyFixtureTest(MethodInfo methodInfo, string assemblyName, string classFullName,
string assemblyLocation, string fixtureType)
{
string methodName = GetMethodName(methodInfo);
string[] hierarchy = [null!, assemblyName, Constants.AssemblyFixturesHierarchyClassName, methodName];
return GetFixtureTest(classFullName, assemblyLocation, fixtureType, methodName, hierarchy);
}

static UnitTestElement GetClassFixtureTest(MethodInfo methodInfo, string assemblyName, string className, string classFullName,
static UnitTestElement GetClassFixtureTest(MethodInfo methodInfo, string classFullName,
string assemblyLocation, string fixtureType)
{
string methodName = GetMethodName(methodInfo);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,7 @@ static string GetApplicationName(ITestApplicationModuleInfo testApplicationModul
? $"dotnet exec {Path.GetFileName(testApplicationModuleInfo.GetCurrentTestApplicationFullPath())}"
: PlatformResources.HelpTestApplicationRunner;

async Task<bool> PrintOptionsAsync(IEnumerable<ICommandLineOptionsProvider> optionProviders, int leftPaddingDepth,
bool builtInOnly = false)
async Task<bool> PrintOptionsAsync(IEnumerable<ICommandLineOptionsProvider> optionProviders, bool builtInOnly = false)
{
CommandLineOption[] options =
optionProviders
Expand Down Expand Up @@ -292,11 +291,11 @@ async Task PrintApplicationUsageAsync(string applicationName)
.ToArray();
// By default, only system options are built-in but some extensions (e.g. retry) are considered as built-in too,
// so we need to union the 2 collections before printing the options.
await PrintOptionsAsync(SystemCommandLineOptionsProviders.Union(nonToolsExtensionProviders), 1, builtInOnly: true);
await PrintOptionsAsync(SystemCommandLineOptionsProviders.Union(nonToolsExtensionProviders), builtInOnly: true);
await outputDevice.DisplayAsync(this, EmptyText);

await outputDevice.DisplayAsync(this, new TextOutputDeviceData(PlatformResources.HelpExtensionOptions));
if (!await PrintOptionsAsync(nonToolsExtensionProviders, 1))
if (!await PrintOptionsAsync(nonToolsExtensionProviders))
{
await outputDevice.DisplayAsync(this, new TextOutputDeviceData(PlatformResources.HelpNoExtensionRegistered));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ static SerializerUtilities()
Serializers = [];
Deserializers = [];

Serializers[typeof(object)] = new ObjectSerializer<object>(o => new Dictionary<string, object?>());
Serializers[typeof(object)] = new ObjectSerializer<object>(_ => new Dictionary<string, object?>());
Serializers[typeof(KeyValuePair<string, string>)] = new ObjectSerializer<KeyValuePair<string, string>>(o =>
{
Dictionary<string, object?> values = new()
Expand Down Expand Up @@ -138,7 +138,7 @@ static SerializerUtilities()
[JsonRpcStrings.Description] = res.Description,
});

Serializers[typeof(DiscoverResponseArgs)] = new ObjectSerializer<DiscoverResponseArgs>(res => new Dictionary<string, object?> { });
Serializers[typeof(DiscoverResponseArgs)] = new ObjectSerializer<DiscoverResponseArgs>(_ => new Dictionary<string, object?>());

Serializers[typeof(RunResponseArgs)] = new ObjectSerializer<RunResponseArgs>(res => new Dictionary<string, object?>
{
Expand Down Expand Up @@ -669,7 +669,7 @@ static SerializerUtilities()
return new CancelRequestArgs(id);
});

Deserializers[typeof(ExitRequestArgs)] = new ObjectDeserializer<ExitRequestArgs>(properties => new ExitRequestArgs());
Deserializers[typeof(ExitRequestArgs)] = new ObjectDeserializer<ExitRequestArgs>(_ => new ExitRequestArgs());

// Deserialize an error
Deserializers[typeof(ErrorMessage)] = new ObjectDeserializer<ErrorMessage>(properties =>
Expand Down