Skip to content

Commit 4a1aaa4

Browse files
danmoseleygithub-actions
authored andcommitted
Fix AE in ExecutableResource
1 parent b8c8b47 commit 4a1aaa4

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/Aspire.Hosting.Tests/ExecutableResourceTests.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,25 @@ public async Task AddExecutableWithArgs()
8282
Assert.Equal(expectedManifest, manifest.ToString());
8383
}
8484

85+
[Fact]
86+
public void ExecutableResourceNullCommand()
87+
=> Assert.Throws<ArgumentNullException>("command", () => new ExecutableResource("name", command: null!, workingDirectory: "."));
88+
89+
[Fact]
90+
public void ExecutableResourceEmptyCommand()
91+
=> Assert.Throws<ArgumentException>("command", () => new ExecutableResource("name", command: "", workingDirectory: "."));
92+
93+
[Fact]
94+
public void ExecutableResourceNullWorkingDirectory()
95+
=> Assert.Throws<ArgumentNullException>("workingDirectory", () => new ExecutableResource("name", command: "cmd", workingDirectory: null!));
96+
97+
[Fact]
98+
public void ExecutableResourceEmptyWorkingDirectory()
99+
{
100+
var er = new ExecutableResource("name", command: "cmd", workingDirectory: "");
101+
Assert.Empty(er.WorkingDirectory);
102+
}
103+
85104
private sealed class TestResource(string name, string connectionString) : Resource(name), IResourceWithConnectionString
86105
{
87106
public ReferenceExpression ConnectionStringExpression =>

0 commit comments

Comments
 (0)