From 7f0a8fca153c05ca4c8d8afb23581601d9373167 Mon Sep 17 00:00:00 2001 From: Dan Moseley Date: Tue, 15 Apr 2025 15:03:30 -0600 Subject: [PATCH 1/8] Fix AE in ExecutableResource --- .../ApplicationModel/ExecutableResource.cs | 4 ++-- .../ExecutableResourceTests.cs | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/Aspire.Hosting/ApplicationModel/ExecutableResource.cs b/src/Aspire.Hosting/ApplicationModel/ExecutableResource.cs index 5a3a7297553..8d7748e14e1 100644 --- a/src/Aspire.Hosting/ApplicationModel/ExecutableResource.cs +++ b/src/Aspire.Hosting/ApplicationModel/ExecutableResource.cs @@ -11,7 +11,7 @@ namespace Aspire.Hosting.ApplicationModel; /// /// The name of the resource. /// The command to execute. -/// The working directory of the executable. +/// The working directory of the executable. Can be empty. public class ExecutableResource(string name, string command, string workingDirectory) : Resource(name), IResourceWithEnvironment, IResourceWithArgs, IResourceWithEndpoints, IResourceWithWaitSupport { @@ -23,7 +23,7 @@ public class ExecutableResource(string name, string command, string workingDirec /// /// Gets the working directory for the executable resource. /// - public string WorkingDirectory { get; } = ThrowIfNullOrEmpty(workingDirectory); + public string WorkingDirectory { get; } = workingDirectory ?? throw new ArgumentNullException(nameof(workingDirectory)); private static string ThrowIfNullOrEmpty([NotNull] string? argument, [CallerArgumentExpression(nameof(argument))] string? paramName = null) { diff --git a/tests/Aspire.Hosting.Tests/ExecutableResourceTests.cs b/tests/Aspire.Hosting.Tests/ExecutableResourceTests.cs index 6cfb9936feb..409e2f49349 100644 --- a/tests/Aspire.Hosting.Tests/ExecutableResourceTests.cs +++ b/tests/Aspire.Hosting.Tests/ExecutableResourceTests.cs @@ -82,6 +82,25 @@ public async Task AddExecutableWithArgs() Assert.Equal(expectedManifest, manifest.ToString()); } + [Fact] + public void ExecutableResourceNullCommand() + => Assert.Throws("command", () => new ExecutableResource("name", command: null!, workingDirectory: ".")); + + [Fact] + public void ExecutableResourceEmptyCommand() + => Assert.Throws("command", () => new ExecutableResource("name", command: "", workingDirectory: ".")); + + [Fact] + public void ExecutableResourceNullWorkingDirectory() + => Assert.Throws("workingDirectory", () => new ExecutableResource("name", command: "cmd", workingDirectory: null!)); + + [Fact] + public void ExecutableResourceEmptyWorkingDirectory() + { + var er = new ExecutableResource("name", command: "cmd", workingDirectory: ""); + Assert.Empty(er.WorkingDirectory); + } + private sealed class TestResource(string name, string connectionString) : Resource(name), IResourceWithConnectionString { public ReferenceExpression ConnectionStringExpression => From 5975c394c330d3e45cbb06177ad8399afa6a2b42 Mon Sep 17 00:00:00 2001 From: Dan Moseley Date: Tue, 15 Apr 2025 18:50:12 -0600 Subject: [PATCH 2/8] more tests --- .../NodeJsPublicApiTests.cs | 24 ++++++----------- .../PythonPublicApiTests.cs | 26 ++++++------------- 2 files changed, 16 insertions(+), 34 deletions(-) diff --git a/tests/Aspire.Hosting.NodeJs.Tests/NodeJsPublicApiTests.cs b/tests/Aspire.Hosting.NodeJs.Tests/NodeJsPublicApiTests.cs index 1e2dc132f44..91acc3afefe 100644 --- a/tests/Aspire.Hosting.NodeJs.Tests/NodeJsPublicApiTests.cs +++ b/tests/Aspire.Hosting.NodeJs.Tests/NodeJsPublicApiTests.cs @@ -42,20 +42,16 @@ public void CtorNodeAppResourceShouldThrowWhenCommandIsNullOrEmpty(bool isNull) Assert.Equal(nameof(command), exception.ParamName); } - [Theory] - [InlineData(true)] - [InlineData(false)] - public void CtorNodeAppResourceShouldThrowWhenWorkingDirectoryIsNullOrEmpty(bool isNull) + [Fact] + public void CtorNodeAppResourceShouldThrowWhenWorkingDirectoryIsNull() { const string name = "NodeApp"; const string command = "npm"; - var workingDirectory = isNull ? null! : string.Empty; + string workingDirectory = null!; var action = () => new NodeAppResource(name, command, workingDirectory); - var exception = isNull - ? Assert.Throws(action) - : Assert.Throws(action); + var exception = Assert.Throws(action); Assert.Equal(nameof(workingDirectory), exception.ParamName); } @@ -136,20 +132,16 @@ public void AddNpmAppShouldThrowWhenNameIsNullOrEmpty(bool isNull) Assert.Equal(nameof(name), exception.ParamName); } - [Theory] - [InlineData(true)] - [InlineData(false)] - public void AddNpmAppShouldThrowWhenWorkingDirectoryIsNullOrEmpty(bool isNull) + [Fact] + public void AddNpmAppShouldThrowWhenWorkingDirectoryIsNull() { var builder = TestDistributedApplicationBuilder.Create(); const string name = "NpmApp"; - var workingDirectory = isNull ? null! : string.Empty; + string workingDirectory = null!; var action = () => builder.AddNpmApp(name, workingDirectory); - var exception = isNull - ? Assert.Throws(action) - : Assert.Throws(action); + var exception = Assert.Throws(action); Assert.Equal(nameof(workingDirectory), exception.ParamName); } diff --git a/tests/Aspire.Hosting.Python.Tests/PythonPublicApiTests.cs b/tests/Aspire.Hosting.Python.Tests/PythonPublicApiTests.cs index a3f36495212..97af7245035 100644 --- a/tests/Aspire.Hosting.Python.Tests/PythonPublicApiTests.cs +++ b/tests/Aspire.Hosting.Python.Tests/PythonPublicApiTests.cs @@ -42,20 +42,15 @@ public void CtorPythonAppResourceShouldThrowWhenExecutablePathIsNullOrEmpty(bool Assert.Equal("command", exception.ParamName); } - [Theory] - [InlineData(true)] - [InlineData(false)] - public void CtorPythonAppResourceShouldThrowWhenAppDirectoryIsNullOrEmpty(bool isNull) + [Fact] + public void CtorPythonAppResourceShouldThrowWhenAppDirectoryIsNull() { const string name = "Python"; const string executablePath = "/src/python"; - var appDirectory = isNull ? null! : string.Empty; - var action = () => new PythonAppResource(name, executablePath, appDirectory); + var action = () => new PythonAppResource(name, executablePath, appDirectory: null!); - var exception = isNull - ? Assert.Throws(action) - : Assert.Throws(action); + var exception = Assert.Throws(action); Assert.Equal("workingDirectory", exception.ParamName); } @@ -379,21 +374,16 @@ public void CtorPythonProjectResourceShouldThrowWhenExecutablePathIsNullOrEmpty( Assert.Equal("command", exception.ParamName); } - [Theory] - [InlineData(true)] - [InlineData(false)] + [Fact] [Obsolete("PythonProjectResource is deprecated. Please use PythonAppResource instead.")] - public void CtorPythonProjectResourceShouldThrowWhenAppDirectoryIsNullOrEmpty(bool isNull) + public void CtorPythonProjectResourceShouldThrowWhenAppDirectoryIsNull() { const string name = "Python"; const string executablePath = "/src/python"; - var projectDirectory = isNull ? null! : string.Empty; - var action = () => new PythonProjectResource(name, executablePath, projectDirectory); + var action = () => new PythonProjectResource(name, executablePath, projectDirectory: null!); - var exception = isNull - ? Assert.Throws(action) - : Assert.Throws(action); + var exception = Assert.Throws(action); Assert.Equal("workingDirectory", exception.ParamName); } From c38ff10ecd94445d2210ab98f97d515a72ecfbfa Mon Sep 17 00:00:00 2001 From: Dan Moseley Date: Tue, 15 Apr 2025 19:56:37 -0600 Subject: [PATCH 3/8] revert fix temporarily --- src/Aspire.Hosting/ApplicationModel/ExecutableResource.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Aspire.Hosting/ApplicationModel/ExecutableResource.cs b/src/Aspire.Hosting/ApplicationModel/ExecutableResource.cs index 8d7748e14e1..5a3a7297553 100644 --- a/src/Aspire.Hosting/ApplicationModel/ExecutableResource.cs +++ b/src/Aspire.Hosting/ApplicationModel/ExecutableResource.cs @@ -11,7 +11,7 @@ namespace Aspire.Hosting.ApplicationModel; /// /// The name of the resource. /// The command to execute. -/// The working directory of the executable. Can be empty. +/// The working directory of the executable. public class ExecutableResource(string name, string command, string workingDirectory) : Resource(name), IResourceWithEnvironment, IResourceWithArgs, IResourceWithEndpoints, IResourceWithWaitSupport { @@ -23,7 +23,7 @@ public class ExecutableResource(string name, string command, string workingDirec /// /// Gets the working directory for the executable resource. /// - public string WorkingDirectory { get; } = workingDirectory ?? throw new ArgumentNullException(nameof(workingDirectory)); + public string WorkingDirectory { get; } = ThrowIfNullOrEmpty(workingDirectory); private static string ThrowIfNullOrEmpty([NotNull] string? argument, [CallerArgumentExpression(nameof(argument))] string? paramName = null) { From 7654b6997182ab172f50c333d6ee45e53d6044e1 Mon Sep 17 00:00:00 2001 From: Dan Moseley Date: Wed, 16 Apr 2025 11:44:44 -0600 Subject: [PATCH 4/8] revert more --- .../NodeJsPublicApiTests.cs | 24 +++++++++++------ .../PythonPublicApiTests.cs | 26 +++++++++++++------ 2 files changed, 34 insertions(+), 16 deletions(-) diff --git a/tests/Aspire.Hosting.NodeJs.Tests/NodeJsPublicApiTests.cs b/tests/Aspire.Hosting.NodeJs.Tests/NodeJsPublicApiTests.cs index 91acc3afefe..1e2dc132f44 100644 --- a/tests/Aspire.Hosting.NodeJs.Tests/NodeJsPublicApiTests.cs +++ b/tests/Aspire.Hosting.NodeJs.Tests/NodeJsPublicApiTests.cs @@ -42,16 +42,20 @@ public void CtorNodeAppResourceShouldThrowWhenCommandIsNullOrEmpty(bool isNull) Assert.Equal(nameof(command), exception.ParamName); } - [Fact] - public void CtorNodeAppResourceShouldThrowWhenWorkingDirectoryIsNull() + [Theory] + [InlineData(true)] + [InlineData(false)] + public void CtorNodeAppResourceShouldThrowWhenWorkingDirectoryIsNullOrEmpty(bool isNull) { const string name = "NodeApp"; const string command = "npm"; - string workingDirectory = null!; + var workingDirectory = isNull ? null! : string.Empty; var action = () => new NodeAppResource(name, command, workingDirectory); - var exception = Assert.Throws(action); + var exception = isNull + ? Assert.Throws(action) + : Assert.Throws(action); Assert.Equal(nameof(workingDirectory), exception.ParamName); } @@ -132,16 +136,20 @@ public void AddNpmAppShouldThrowWhenNameIsNullOrEmpty(bool isNull) Assert.Equal(nameof(name), exception.ParamName); } - [Fact] - public void AddNpmAppShouldThrowWhenWorkingDirectoryIsNull() + [Theory] + [InlineData(true)] + [InlineData(false)] + public void AddNpmAppShouldThrowWhenWorkingDirectoryIsNullOrEmpty(bool isNull) { var builder = TestDistributedApplicationBuilder.Create(); const string name = "NpmApp"; - string workingDirectory = null!; + var workingDirectory = isNull ? null! : string.Empty; var action = () => builder.AddNpmApp(name, workingDirectory); - var exception = Assert.Throws(action); + var exception = isNull + ? Assert.Throws(action) + : Assert.Throws(action); Assert.Equal(nameof(workingDirectory), exception.ParamName); } diff --git a/tests/Aspire.Hosting.Python.Tests/PythonPublicApiTests.cs b/tests/Aspire.Hosting.Python.Tests/PythonPublicApiTests.cs index 97af7245035..a3f36495212 100644 --- a/tests/Aspire.Hosting.Python.Tests/PythonPublicApiTests.cs +++ b/tests/Aspire.Hosting.Python.Tests/PythonPublicApiTests.cs @@ -42,15 +42,20 @@ public void CtorPythonAppResourceShouldThrowWhenExecutablePathIsNullOrEmpty(bool Assert.Equal("command", exception.ParamName); } - [Fact] - public void CtorPythonAppResourceShouldThrowWhenAppDirectoryIsNull() + [Theory] + [InlineData(true)] + [InlineData(false)] + public void CtorPythonAppResourceShouldThrowWhenAppDirectoryIsNullOrEmpty(bool isNull) { const string name = "Python"; const string executablePath = "/src/python"; + var appDirectory = isNull ? null! : string.Empty; - var action = () => new PythonAppResource(name, executablePath, appDirectory: null!); + var action = () => new PythonAppResource(name, executablePath, appDirectory); - var exception = Assert.Throws(action); + var exception = isNull + ? Assert.Throws(action) + : Assert.Throws(action); Assert.Equal("workingDirectory", exception.ParamName); } @@ -374,16 +379,21 @@ public void CtorPythonProjectResourceShouldThrowWhenExecutablePathIsNullOrEmpty( Assert.Equal("command", exception.ParamName); } - [Fact] + [Theory] + [InlineData(true)] + [InlineData(false)] [Obsolete("PythonProjectResource is deprecated. Please use PythonAppResource instead.")] - public void CtorPythonProjectResourceShouldThrowWhenAppDirectoryIsNull() + public void CtorPythonProjectResourceShouldThrowWhenAppDirectoryIsNullOrEmpty(bool isNull) { const string name = "Python"; const string executablePath = "/src/python"; + var projectDirectory = isNull ? null! : string.Empty; - var action = () => new PythonProjectResource(name, executablePath, projectDirectory: null!); + var action = () => new PythonProjectResource(name, executablePath, projectDirectory); - var exception = Assert.Throws(action); + var exception = isNull + ? Assert.Throws(action) + : Assert.Throws(action); Assert.Equal("workingDirectory", exception.ParamName); } From 6734e952812db2bec3ad464ad0af59f09b9b3a10 Mon Sep 17 00:00:00 2001 From: Dan Moseley Date: Wed, 16 Apr 2025 14:02:48 -0600 Subject: [PATCH 5/8] More tests --- .../ExecutableResourceTests.cs | 20 +------------------ 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/tests/Aspire.Hosting.Tests/ExecutableResourceTests.cs b/tests/Aspire.Hosting.Tests/ExecutableResourceTests.cs index 409e2f49349..736bfc06d24 100644 --- a/tests/Aspire.Hosting.Tests/ExecutableResourceTests.cs +++ b/tests/Aspire.Hosting.Tests/ExecutableResourceTests.cs @@ -10,6 +10,7 @@ namespace Aspire.Hosting.Tests; public class ExecutableResourceTests { + // comment to trigger build [Fact] public async Task AddExecutableWithArgs() { @@ -82,25 +83,6 @@ public async Task AddExecutableWithArgs() Assert.Equal(expectedManifest, manifest.ToString()); } - [Fact] - public void ExecutableResourceNullCommand() - => Assert.Throws("command", () => new ExecutableResource("name", command: null!, workingDirectory: ".")); - - [Fact] - public void ExecutableResourceEmptyCommand() - => Assert.Throws("command", () => new ExecutableResource("name", command: "", workingDirectory: ".")); - - [Fact] - public void ExecutableResourceNullWorkingDirectory() - => Assert.Throws("workingDirectory", () => new ExecutableResource("name", command: "cmd", workingDirectory: null!)); - - [Fact] - public void ExecutableResourceEmptyWorkingDirectory() - { - var er = new ExecutableResource("name", command: "cmd", workingDirectory: ""); - Assert.Empty(er.WorkingDirectory); - } - private sealed class TestResource(string name, string connectionString) : Resource(name), IResourceWithConnectionString { public ReferenceExpression ConnectionStringExpression => From b8c8b4715e95bf5d3b72da55bcf9f2314c76d68c Mon Sep 17 00:00:00 2001 From: Dan Moseley Date: Tue, 15 Apr 2025 15:03:30 -0600 Subject: [PATCH 6/8] Fix AE in ExecutableResource not tests --- src/Aspire.Hosting/ApplicationModel/ExecutableResource.cs | 4 ++-- tests/Aspire.Hosting.Tests/ExecutableResourceTests.cs | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Aspire.Hosting/ApplicationModel/ExecutableResource.cs b/src/Aspire.Hosting/ApplicationModel/ExecutableResource.cs index 5a3a7297553..8d7748e14e1 100644 --- a/src/Aspire.Hosting/ApplicationModel/ExecutableResource.cs +++ b/src/Aspire.Hosting/ApplicationModel/ExecutableResource.cs @@ -11,7 +11,7 @@ namespace Aspire.Hosting.ApplicationModel; /// /// The name of the resource. /// The command to execute. -/// The working directory of the executable. +/// The working directory of the executable. Can be empty. public class ExecutableResource(string name, string command, string workingDirectory) : Resource(name), IResourceWithEnvironment, IResourceWithArgs, IResourceWithEndpoints, IResourceWithWaitSupport { @@ -23,7 +23,7 @@ public class ExecutableResource(string name, string command, string workingDirec /// /// Gets the working directory for the executable resource. /// - public string WorkingDirectory { get; } = ThrowIfNullOrEmpty(workingDirectory); + public string WorkingDirectory { get; } = workingDirectory ?? throw new ArgumentNullException(nameof(workingDirectory)); private static string ThrowIfNullOrEmpty([NotNull] string? argument, [CallerArgumentExpression(nameof(argument))] string? paramName = null) { diff --git a/tests/Aspire.Hosting.Tests/ExecutableResourceTests.cs b/tests/Aspire.Hosting.Tests/ExecutableResourceTests.cs index 736bfc06d24..6cfb9936feb 100644 --- a/tests/Aspire.Hosting.Tests/ExecutableResourceTests.cs +++ b/tests/Aspire.Hosting.Tests/ExecutableResourceTests.cs @@ -10,7 +10,6 @@ namespace Aspire.Hosting.Tests; public class ExecutableResourceTests { - // comment to trigger build [Fact] public async Task AddExecutableWithArgs() { From 4a1aaa452c14954e613faef26ede7704cee90d47 Mon Sep 17 00:00:00 2001 From: Dan Moseley Date: Tue, 15 Apr 2025 15:03:30 -0600 Subject: [PATCH 7/8] Fix AE in ExecutableResource --- .../ExecutableResourceTests.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/Aspire.Hosting.Tests/ExecutableResourceTests.cs b/tests/Aspire.Hosting.Tests/ExecutableResourceTests.cs index 6cfb9936feb..409e2f49349 100644 --- a/tests/Aspire.Hosting.Tests/ExecutableResourceTests.cs +++ b/tests/Aspire.Hosting.Tests/ExecutableResourceTests.cs @@ -82,6 +82,25 @@ public async Task AddExecutableWithArgs() Assert.Equal(expectedManifest, manifest.ToString()); } + [Fact] + public void ExecutableResourceNullCommand() + => Assert.Throws("command", () => new ExecutableResource("name", command: null!, workingDirectory: ".")); + + [Fact] + public void ExecutableResourceEmptyCommand() + => Assert.Throws("command", () => new ExecutableResource("name", command: "", workingDirectory: ".")); + + [Fact] + public void ExecutableResourceNullWorkingDirectory() + => Assert.Throws("workingDirectory", () => new ExecutableResource("name", command: "cmd", workingDirectory: null!)); + + [Fact] + public void ExecutableResourceEmptyWorkingDirectory() + { + var er = new ExecutableResource("name", command: "cmd", workingDirectory: ""); + Assert.Empty(er.WorkingDirectory); + } + private sealed class TestResource(string name, string connectionString) : Resource(name), IResourceWithConnectionString { public ReferenceExpression ConnectionStringExpression => From ef6f857e1206639c71c40e8cd3d2520593f7a835 Mon Sep 17 00:00:00 2001 From: Dan Moseley Date: Tue, 15 Apr 2025 18:50:12 -0600 Subject: [PATCH 8/8] more tests --- .../NodeJsPublicApiTests.cs | 24 ++++++----------- .../PythonPublicApiTests.cs | 26 ++++++------------- 2 files changed, 16 insertions(+), 34 deletions(-) diff --git a/tests/Aspire.Hosting.NodeJs.Tests/NodeJsPublicApiTests.cs b/tests/Aspire.Hosting.NodeJs.Tests/NodeJsPublicApiTests.cs index 1e2dc132f44..91acc3afefe 100644 --- a/tests/Aspire.Hosting.NodeJs.Tests/NodeJsPublicApiTests.cs +++ b/tests/Aspire.Hosting.NodeJs.Tests/NodeJsPublicApiTests.cs @@ -42,20 +42,16 @@ public void CtorNodeAppResourceShouldThrowWhenCommandIsNullOrEmpty(bool isNull) Assert.Equal(nameof(command), exception.ParamName); } - [Theory] - [InlineData(true)] - [InlineData(false)] - public void CtorNodeAppResourceShouldThrowWhenWorkingDirectoryIsNullOrEmpty(bool isNull) + [Fact] + public void CtorNodeAppResourceShouldThrowWhenWorkingDirectoryIsNull() { const string name = "NodeApp"; const string command = "npm"; - var workingDirectory = isNull ? null! : string.Empty; + string workingDirectory = null!; var action = () => new NodeAppResource(name, command, workingDirectory); - var exception = isNull - ? Assert.Throws(action) - : Assert.Throws(action); + var exception = Assert.Throws(action); Assert.Equal(nameof(workingDirectory), exception.ParamName); } @@ -136,20 +132,16 @@ public void AddNpmAppShouldThrowWhenNameIsNullOrEmpty(bool isNull) Assert.Equal(nameof(name), exception.ParamName); } - [Theory] - [InlineData(true)] - [InlineData(false)] - public void AddNpmAppShouldThrowWhenWorkingDirectoryIsNullOrEmpty(bool isNull) + [Fact] + public void AddNpmAppShouldThrowWhenWorkingDirectoryIsNull() { var builder = TestDistributedApplicationBuilder.Create(); const string name = "NpmApp"; - var workingDirectory = isNull ? null! : string.Empty; + string workingDirectory = null!; var action = () => builder.AddNpmApp(name, workingDirectory); - var exception = isNull - ? Assert.Throws(action) - : Assert.Throws(action); + var exception = Assert.Throws(action); Assert.Equal(nameof(workingDirectory), exception.ParamName); } diff --git a/tests/Aspire.Hosting.Python.Tests/PythonPublicApiTests.cs b/tests/Aspire.Hosting.Python.Tests/PythonPublicApiTests.cs index a3f36495212..97af7245035 100644 --- a/tests/Aspire.Hosting.Python.Tests/PythonPublicApiTests.cs +++ b/tests/Aspire.Hosting.Python.Tests/PythonPublicApiTests.cs @@ -42,20 +42,15 @@ public void CtorPythonAppResourceShouldThrowWhenExecutablePathIsNullOrEmpty(bool Assert.Equal("command", exception.ParamName); } - [Theory] - [InlineData(true)] - [InlineData(false)] - public void CtorPythonAppResourceShouldThrowWhenAppDirectoryIsNullOrEmpty(bool isNull) + [Fact] + public void CtorPythonAppResourceShouldThrowWhenAppDirectoryIsNull() { const string name = "Python"; const string executablePath = "/src/python"; - var appDirectory = isNull ? null! : string.Empty; - var action = () => new PythonAppResource(name, executablePath, appDirectory); + var action = () => new PythonAppResource(name, executablePath, appDirectory: null!); - var exception = isNull - ? Assert.Throws(action) - : Assert.Throws(action); + var exception = Assert.Throws(action); Assert.Equal("workingDirectory", exception.ParamName); } @@ -379,21 +374,16 @@ public void CtorPythonProjectResourceShouldThrowWhenExecutablePathIsNullOrEmpty( Assert.Equal("command", exception.ParamName); } - [Theory] - [InlineData(true)] - [InlineData(false)] + [Fact] [Obsolete("PythonProjectResource is deprecated. Please use PythonAppResource instead.")] - public void CtorPythonProjectResourceShouldThrowWhenAppDirectoryIsNullOrEmpty(bool isNull) + public void CtorPythonProjectResourceShouldThrowWhenAppDirectoryIsNull() { const string name = "Python"; const string executablePath = "/src/python"; - var projectDirectory = isNull ? null! : string.Empty; - var action = () => new PythonProjectResource(name, executablePath, projectDirectory); + var action = () => new PythonProjectResource(name, executablePath, projectDirectory: null!); - var exception = isNull - ? Assert.Throws(action) - : Assert.Throws(action); + var exception = Assert.Throws(action); Assert.Equal("workingDirectory", exception.ParamName); }