1515
1616namespace Aspire . Hosting . Tests ;
1717
18- public class ManifestGenerationTests
18+ public class ManifestGenerationTests ( ITestOutputHelper testOutputHelper )
1919{
2020 [ Fact ]
2121 public void EnsureAddParameterWithSecretFalseDoesntEmitSecretField ( )
@@ -91,7 +91,7 @@ public void EnsureWorkerProjectDoesNotGetBindingsGenerated()
9191 [ Fact ]
9292 public async Task WithContainerRegistryUpdatesContainerImageAnnotationsDuringPublish ( )
9393 {
94- var builder = DistributedApplication . CreateBuilder ( new DistributedApplicationOptions
94+ var builder = CreateBuilder ( new DistributedApplicationOptions
9595 {
9696 Args = GetManifestArgs ( ) ,
9797 ContainerRegistryOverride = "myprivateregistry.company.com"
@@ -113,7 +113,7 @@ public async Task WithContainerRegistryUpdatesContainerImageAnnotationsDuringPub
113113 [ Fact ]
114114 public void ExcludeLaunchProfileOmitsBindings ( )
115115 {
116- var appBuilder = DistributedApplication . CreateBuilder ( new DistributedApplicationOptions
116+ var appBuilder = CreateBuilder ( new DistributedApplicationOptions
117117 { Args = GetJsonManifestArgs ( ) , DisableDashboard = true , AssemblyName = typeof ( ManifestGenerationTests ) . Assembly . FullName } ) ;
118118 var manifestStore = new JsonDocumentManifestStore ( ) ;
119119 appBuilder . AddProject < Projects . ServiceA > ( "servicea" , launchProfileName : null ) ;
@@ -509,7 +509,7 @@ public void VerifyTestProgramFullManifest()
509509 [ Fact ]
510510 public async Task ParameterInputDefaultValuesGenerateCorrectly ( )
511511 {
512- var appBuilder = DistributedApplication . CreateBuilder ( ) ;
512+ var appBuilder = CreateBuilder ( ) ;
513513 var param = appBuilder . AddParameter ( "param" ) ;
514514 param . Resource . Default = new GenerateParameterDefault ( )
515515 {
@@ -556,7 +556,7 @@ public async Task ParameterInputDefaultValuesGenerateCorrectly()
556556 [ Fact ]
557557 public async Task ContainerFilesAreWrittenToManifest ( )
558558 {
559- var builder = DistributedApplication . CreateBuilder ( new DistributedApplicationOptions
559+ var builder = CreateBuilder ( new DistributedApplicationOptions
560560 {
561561 Args = GetManifestArgs ( )
562562 } ) ;
@@ -598,7 +598,7 @@ public async Task ContainerFilesAreWrittenToManifest()
598598 [ Fact ]
599599 public async Task ContainerFilesWithMultipleSourcesAreWrittenToManifest ( )
600600 {
601- var builder = DistributedApplication . CreateBuilder ( new DistributedApplicationOptions
601+ var builder = CreateBuilder ( new DistributedApplicationOptions
602602 {
603603 Args = GetManifestArgs ( )
604604 } ) ;
@@ -642,7 +642,7 @@ public async Task ContainerFilesWithMultipleSourcesAreWrittenToManifest()
642642 [ Fact ]
643643 public async Task ContainerFilesWithMultipleDestinationsAreWrittenToManifest ( )
644644 {
645- var builder = DistributedApplication . CreateBuilder ( new DistributedApplicationOptions
645+ var builder = CreateBuilder ( new DistributedApplicationOptions
646646 {
647647 Args = GetManifestArgs ( )
648648 } ) ;
@@ -695,9 +695,10 @@ public async Task ContainerFilesWithMultipleDestinationsAreWrittenToManifest()
695695 Assert . Equal ( expectedManifest , destManifest . ToString ( ) ) ;
696696 }
697697
698- private static TestProgram CreateTestProgramJsonDocumentManifestPublisher ( bool includeIntegrationServices = false , bool includeNodeApp = false )
698+ private TestProgram CreateTestProgramJsonDocumentManifestPublisher ( bool includeIntegrationServices = false , bool includeNodeApp = false )
699699 {
700700 var program = TestProgram . Create < ManifestGenerationTests > ( GetJsonManifestArgs ( ) , includeIntegrationServices , includeNodeApp ) ;
701+ program . AppBuilder . Services . AddTestAndResourceLogging ( testOutputHelper ) ;
701702 program . AppBuilder . Pipeline . AddJsonDocumentManifestPublishing ( ) ;
702703 return program ;
703704 }
@@ -713,4 +714,18 @@ private static string[] GetManifestArgs()
713714 var manifestPath = Path . Combine ( Path . GetTempPath ( ) , "tempmanifests" , Guid . NewGuid ( ) . ToString ( ) , "manifest.json" ) ;
714715 return [ "--operation" , "publish" , "--step" , "publish-manifest" , "--output-path" , manifestPath ] ;
715716 }
717+
718+ private IDistributedApplicationBuilder CreateBuilder ( DistributedApplicationOptions options )
719+ {
720+ var builder = DistributedApplication . CreateBuilder ( options ) ;
721+ builder . Services . AddTestAndResourceLogging ( testOutputHelper ) ;
722+ return builder ;
723+ }
724+
725+ private IDistributedApplicationBuilder CreateBuilder ( )
726+ {
727+ var builder = DistributedApplication . CreateBuilder ( ) ;
728+ builder . Services . AddTestAndResourceLogging ( testOutputHelper ) ;
729+ return builder ;
730+ }
716731}
0 commit comments