Skip to content

Commit 138bc1c

Browse files
Automatically supply 2nd parameter to Guard.Argument calls.
1 parent bc5b7db commit 138bc1c

34 files changed

+97
-97
lines changed

src/NUnitCommon/nunit.agent.core/Communication/Transports/Tcp/TestAgentTcpTransport.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ public class TestAgentTcpTransport : ITestAgentTransport, ITestEventListener
2525

2626
public TestAgentTcpTransport(RemoteTestAgent agent, string serverUrl)
2727
{
28-
Guard.ArgumentNotNull(agent, nameof(agent));
28+
Guard.ArgumentNotNull(agent);
2929
Agent = agent;
3030

31-
Guard.ArgumentNotNullOrEmpty(serverUrl, nameof(serverUrl));
31+
Guard.ArgumentNotNullOrEmpty(serverUrl);
3232
_agencyUrl = serverUrl;
3333

3434
var parts = serverUrl.Split(PortSeparator);

src/NUnitCommon/nunit.agent.core/Drivers/NUnit3DriverFactory.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public bool IsSupportedTestFramework(AssemblyName reference)
3030
/// <returns>An IFrameworkDriver</returns>
3131
public IFrameworkDriver GetDriver(AppDomain domain, string id, AssemblyName reference)
3232
{
33-
Guard.ArgumentNotNullOrEmpty(id, nameof(id));
33+
Guard.ArgumentNotNullOrEmpty(id);
3434
Guard.ArgumentValid(IsSupportedTestFramework(reference), "Invalid framework", nameof(reference));
3535

3636
log.Info("Using NUnitFrameworkDriver");
@@ -44,7 +44,7 @@ public IFrameworkDriver GetDriver(AppDomain domain, string id, AssemblyName refe
4444
/// <returns></returns>
4545
public IFrameworkDriver GetDriver(string id, AssemblyName reference)
4646
{
47-
Guard.ArgumentNotNullOrEmpty(id, nameof(id));
47+
Guard.ArgumentNotNullOrEmpty(id);
4848
Guard.ArgumentValid(IsSupportedTestFramework(reference), "Invalid framework", nameof(reference));
4949
log.Info("Using NUnitFrameworkDriver");
5050
return new NUnitFrameworkDriver(id, reference);

src/NUnitCommon/nunit.agent.core/Drivers/NUnitFrameworkApi2009.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ internal class NUnitFrameworkApi2009 : NUnitFrameworkApi
3737

3838
public NUnitFrameworkApi2009(AppDomain testDomain, string driverId, AssemblyName nunitRef)
3939
{
40-
Guard.ArgumentNotNull(testDomain, nameof(testDomain));
41-
Guard.ArgumentNotNull(driverId, nameof(driverId));
42-
Guard.ArgumentNotNull(nunitRef, nameof(nunitRef));
40+
Guard.ArgumentNotNull(testDomain);
41+
Guard.ArgumentNotNull(driverId);
42+
Guard.ArgumentNotNull(nunitRef);
4343

4444
_testDomain = testDomain;
4545
_driverId = driverId;

src/NUnitCommon/nunit.agent.core/Drivers/NUnitFrameworkApi2018.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,17 @@ public class NUnitFrameworkApi2018 : NUnitFrameworkApi
4848

4949
public NUnitFrameworkApi2018(string driverId, AssemblyName nunitRef)
5050
{
51-
Guard.ArgumentNotNull(driverId, nameof(driverId));
52-
Guard.ArgumentNotNull(nunitRef, nameof(nunitRef));
51+
Guard.ArgumentNotNull(driverId);
52+
Guard.ArgumentNotNull(nunitRef);
5353

5454
_driverId = driverId;
5555
_nunitRef = nunitRef;
5656
}
5757

5858
public string Load(string testAssemblyPath, IDictionary<string, object> settings)
5959
{
60-
Guard.ArgumentNotNull(testAssemblyPath, nameof(testAssemblyPath));
61-
Guard.ArgumentNotNull(settings, nameof(settings));
60+
Guard.ArgumentNotNull(testAssemblyPath);
61+
Guard.ArgumentNotNull(settings);
6262
Guard.ArgumentValid(File.Exists(testAssemblyPath), "Framework driver called with a file name that doesn't exist.", nameof(testAssemblyPath));
6363
log.Info($"Loading {testAssemblyPath} - see separate log file");
6464

src/NUnitCommon/nunit.agent.core/Drivers/NUnitFrameworkDriver.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ public class NUnitFrameworkDriver : IFrameworkDriver
2727
/// <param name="nunitRef">An AssemblyName referring to the test framework.</param>
2828
public NUnitFrameworkDriver(AppDomain testDomain, string id, AssemblyName nunitRef)
2929
{
30-
Guard.ArgumentNotNull(testDomain, nameof(testDomain));
31-
Guard.ArgumentNotNullOrEmpty(id, nameof(id));
32-
Guard.ArgumentNotNull(nunitRef, nameof(nunitRef));
30+
Guard.ArgumentNotNull(testDomain);
31+
Guard.ArgumentNotNullOrEmpty(id);
32+
Guard.ArgumentNotNull(nunitRef);
3333

3434
ID = id;
3535

@@ -60,11 +60,11 @@ public NUnitFrameworkDriver(AppDomain testDomain, string id, AssemblyName nunitR
6060
/// <param name="nunitRef">An AssemblyName referring to the test framework.</param>
6161
internal NUnitFrameworkDriver(AppDomain testDomain, string api, string id, AssemblyName nunitRef)
6262
{
63-
Guard.ArgumentNotNull(testDomain, nameof(testDomain));
64-
Guard.ArgumentNotNull(api, nameof(api));
63+
Guard.ArgumentNotNull(testDomain);
64+
Guard.ArgumentNotNull(api);
6565
Guard.ArgumentValid(api == "2009" || api == "2018", $"Invalid API specified: {api}", nameof(api));
66-
Guard.ArgumentNotNullOrEmpty(id, nameof(id));
67-
Guard.ArgumentNotNull(nunitRef, nameof(nunitRef));
66+
Guard.ArgumentNotNullOrEmpty(id);
67+
Guard.ArgumentNotNull(nunitRef);
6868

6969
ID = id;
7070
API = api;
@@ -90,8 +90,8 @@ internal NUnitFrameworkDriver(AppDomain testDomain, string api, string id, Assem
9090
/// <param name="reference">An AssemblyName referring to the test framework.</param>
9191
public NUnitFrameworkDriver(string id, AssemblyName nunitRef)
9292
{
93-
Guard.ArgumentNotNullOrEmpty(id, nameof(id));
94-
Guard.ArgumentNotNull(nunitRef, nameof(nunitRef));
93+
Guard.ArgumentNotNullOrEmpty(id);
94+
Guard.ArgumentNotNull(nunitRef);
9595

9696
ID = id;
9797
API = "2018";

src/NUnitCommon/nunit.agent.core/Runners/DomainManager.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ private void UnloadOnThread()
169169
/// <returns>The ApplicationBase</returns>
170170
public static string? GetApplicationBase(TestPackage package)
171171
{
172-
Guard.ArgumentNotNull(package, "package");
172+
Guard.ArgumentNotNull(package);
173173

174174
var appBase = package.GetSetting(EnginePackageSettings.BasePath, string.Empty);
175175

@@ -190,8 +190,8 @@ private void UnloadOnThread()
190190

191191
public static string? GetConfigFile(string appBase, TestPackage package)
192192
{
193-
Guard.ArgumentNotNullOrEmpty(appBase, "appBase");
194-
Guard.ArgumentNotNull(package, "package");
193+
Guard.ArgumentNotNullOrEmpty(appBase);
194+
Guard.ArgumentNotNull(package);
195195

196196
// Use provided setting if available
197197
string configFile = package.GetSetting(EnginePackageSettings.ConfigurationFile, string.Empty);

src/NUnitCommon/nunit.agent.core/Runners/TestAgentRunner.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public bool IsPackageLoaded
4747

4848
public TestAgentRunner(TestPackage package)
4949
{
50-
Guard.ArgumentNotNull(package, nameof(package));
50+
Guard.ArgumentNotNull(package);
5151
//Guard.ArgumentValid(package.IsAssemblyPackage(), "TestAgentRunner requires a package with a single assembly", nameof(package));
5252
var assemblyPackages = package.Select(p => !p.HasSubPackages());
5353
Guard.ArgumentValid(assemblyPackages.Count == 1, "TestAgentRunner requires a package with a single assembly", nameof(package));

src/NUnitCommon/nunit.agent.core/TestAssemblyResolver.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public void Dispose()
9191

9292
private Assembly? OnResolving(AssemblyLoadContext loadContext, AssemblyName assemblyName)
9393
{
94-
Guard.ArgumentNotNull(loadContext, nameof(loadContext));
94+
Guard.ArgumentNotNull(loadContext);
9595

9696
Assembly? loadedAssembly;
9797
foreach (var strategy in ResolutionStrategies)

src/NUnitCommon/nunit.common/FileSystemAccess/Directory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public sealed class Directory : IDirectory
2323
/// <exception cref="SIO.PathTooLongException"><paramref name="path"/> exceeds the system-defined maximum length.</exception>
2424
public Directory(string path)
2525
{
26-
Guard.ArgumentNotNull(path, nameof(path));
26+
Guard.ArgumentNotNull(path);
2727

2828
if (path.IndexOfAny(SIO.Path.GetInvalidPathChars()) > -1)
2929
{

src/NUnitCommon/nunit.common/FileSystemAccess/DirectoryFinder.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ public DirectoryFinder(IFileSystem fileSystem)
2727
/// <inheritdoc/>
2828
public IEnumerable<IDirectory> GetDirectories(IDirectory startDirectory, string pattern)
2929
{
30-
Guard.ArgumentNotNull(startDirectory, nameof(startDirectory));
31-
Guard.ArgumentNotNull(pattern, nameof(pattern));
30+
Guard.ArgumentNotNull(startDirectory);
31+
Guard.ArgumentNotNull(pattern);
3232

3333
if (Path.DirectorySeparatorChar == '\\')
3434
pattern = pattern.Replace(Path.DirectorySeparatorChar, '/');
@@ -63,8 +63,8 @@ public IEnumerable<IDirectory> GetDirectories(IDirectory startDirectory, string
6363
/// <inheritdoc/>
6464
public IEnumerable<IFile> GetFiles(IDirectory startDirectory, string pattern)
6565
{
66-
Guard.ArgumentNotNull(startDirectory, nameof(startDirectory));
67-
Guard.ArgumentNotNullOrEmpty(pattern, nameof(pattern));
66+
Guard.ArgumentNotNull(startDirectory);
67+
Guard.ArgumentNotNullOrEmpty(pattern);
6868

6969
// If there is no directory path in pattern, delegate to DirectoryInfo
7070
int lastSep = pattern.LastIndexOf('/');

0 commit comments

Comments
 (0)