File tree Expand file tree Collapse file tree 3 files changed +41
-7
lines changed Expand file tree Collapse file tree 3 files changed +41
-7
lines changed Original file line number Diff line number Diff line change 11using Aspire . Hosting ;
2+ using Aspire . Hosting . ApplicationModel ;
23
34namespace CommunityToolkit . Aspire . Hosting . Bun . Tests ;
45
@@ -140,4 +141,22 @@ public void AddBunEmptyEntryPointThrows()
140141
141142 Assert . Throws < ArgumentException > ( ( ) => builder . AddBunApp ( "bun" , entryPoint : "" ) ) ;
142143 }
144+
145+ [ Fact ]
146+ public void BunAppWithPackageInstallationCreatesInstallerResource ( )
147+ {
148+ var builder = DistributedApplication . CreateBuilder ( ) ;
149+
150+ builder . AddBunApp ( "bun" ) . WithBunPackageInstallation ( ) ;
151+
152+ using var app = builder . Build ( ) ;
153+
154+ var appModel = app . Services . GetRequiredService < DistributedApplicationModel > ( ) ;
155+
156+ var bunResource = Assert . Single ( appModel . Resources . OfType < BunAppResource > ( ) ) ;
157+ var installerResource = Assert . Single ( appModel . Resources . OfType < BunInstallerResource > ( ) ) ;
158+
159+ Assert . Equal ( "bun-bun-install" , installerResource . Name ) ;
160+ Assert . Equal ( "bun" , installerResource . Command ) ;
161+ }
143162}
Original file line number Diff line number Diff line change 11// Licensed to the .NET Foundation under one or more agreements.
22// The .NET Foundation licenses this file to you under the MIT license.
33
4- using System . Runtime . CompilerServices ;
54using Aspire . Hosting ;
65using Aspire . Hosting . Utils ;
76
@@ -30,7 +29,7 @@ public async Task WithDaprSideCarAddsAnnotationAndSidecarResource()
3029
3130 using var app = builder . Build ( ) ;
3231
33- await ExecuteBeforeStartHooksAsync ( app , default ) ;
32+ await app . StartAsync ( ) ;
3433
3534 var model = app . Services . GetRequiredService < DistributedApplicationModel > ( ) ;
3635
@@ -129,7 +128,7 @@ public async Task WithDaprSideCarAddsAnnotationBasedOnTheSidecarAppOptions(strin
129128 } ) ;
130129 }
131130 using var app = builder . Build ( ) ;
132- await ExecuteBeforeStartHooksAsync ( app , default ) ;
131+ await app . StartAsync ( ) ;
133132
134133 var model = app . Services . GetRequiredService < DistributedApplicationModel > ( ) ;
135134
@@ -165,7 +164,4 @@ public async Task WithDaprSideCarAddsAnnotationBasedOnTheSidecarAppOptions(strin
165164 Assert . Contains ( $ "--app-protocol { expectedSchema } ", commandline ) ;
166165 Assert . NotNull ( container . Annotations . OfType < DaprSidecarAnnotation > ( ) ) ;
167166 }
168-
169- [ UnsafeAccessor ( UnsafeAccessorKind . Method , Name = "ExecuteBeforeStartHooksAsync" ) ]
170- private static extern Task ExecuteBeforeStartHooksAsync ( DistributedApplication app , CancellationToken cancellationToken ) ;
171167}
Original file line number Diff line number Diff line change 11using Aspire . Hosting ;
2+ using Aspire . Hosting . ApplicationModel ;
23
34namespace CommunityToolkit . Aspire . Hosting . Deno . Tests ;
45
@@ -40,4 +41,22 @@ public void DenoAppUsesDenoCommand()
4041
4142 Assert . Equal ( "deno" , resource . Command ) ;
4243 }
43- }
44+
45+ [ Fact ]
46+ public void DenoAppWithPackageInstallationCreatesInstallerResource ( )
47+ {
48+ var builder = DistributedApplication . CreateBuilder ( ) ;
49+
50+ builder . AddDenoApp ( "deno" , Environment . CurrentDirectory ) . WithDenoPackageInstallation ( ) ;
51+
52+ using var app = builder . Build ( ) ;
53+
54+ var appModel = app . Services . GetRequiredService < DistributedApplicationModel > ( ) ;
55+
56+ var denoResource = Assert . Single ( appModel . Resources . OfType < DenoAppResource > ( ) ) ;
57+ var installerResource = Assert . Single ( appModel . Resources . OfType < DenoInstallerResource > ( ) ) ;
58+
59+ Assert . Equal ( "deno-deno-install" , installerResource . Name ) ;
60+ Assert . Equal ( "deno" , installerResource . Command ) ;
61+ }
62+ }
You can’t perform that action at this time.
0 commit comments