@@ -590,16 +590,23 @@ public async Task PublicRelease_RegEx_SatisfiedByCheckedOutBranch()
590590 }
591591
592592 [ Theory ]
593- [ InlineData ( false ) ]
594- [ InlineData ( true ) ]
595- public async Task AssemblyInfo ( bool isVB )
593+ [ InlineData ( false , false ) ]
594+ [ InlineData ( true , false ) ]
595+ [ InlineData ( false , true ) ]
596+ [ InlineData ( true , true ) ]
597+ public async Task AssemblyInfo ( bool isVB , bool includeNonVersionAttributes )
596598 {
597599 this . WriteVersionFile ( ) ;
598600 if ( isVB )
599601 {
600602 this . MakeItAVBProject ( ) ;
601603 }
602604
605+ if ( includeNonVersionAttributes )
606+ {
607+ this . testProject . AddProperty ( "NBGV_EmitNonVersionCustomAttributes" , "true" ) ;
608+ }
609+
603610 var result = await this . BuildAsync ( "Build" , logVerbosity : LoggerVerbosity . Minimal ) ;
604611 string assemblyPath = result . BuildResult . ProjectStateAfterBuild . GetPropertyValue ( "TargetPath" ) ;
605612 string versionFileContent = File . ReadAllText ( Path . Combine ( this . projectDirectory , result . BuildResult . ProjectStateAfterBuild . GetPropertyValue ( "VersionSourceFile" ) ) ) ;
@@ -619,22 +626,43 @@ public async Task AssemblyInfo(bool isVB)
619626 Assert . Equal ( new Version ( result . AssemblyVersion ) , assembly . GetName ( ) . Version ) ;
620627 Assert . Equal ( result . AssemblyFileVersion , assemblyFileVersion . Version ) ;
621628 Assert . Equal ( result . AssemblyInformationalVersion , assemblyInformationalVersion . InformationalVersion ) ;
622- Assert . Equal ( result . AssemblyTitle , assemblyTitle . Title ) ;
623- Assert . Equal ( result . AssemblyProduct , assemblyProduct . Product ) ;
624- Assert . Equal ( result . AssemblyCompany , assemblyCompany . Company ) ;
625- Assert . Equal ( result . AssemblyCopyright , assemblyCopyright . Copyright ) ;
629+ if ( includeNonVersionAttributes )
630+ {
631+ Assert . Equal ( result . AssemblyTitle , assemblyTitle . Title ) ;
632+ Assert . Equal ( result . AssemblyProduct , assemblyProduct . Product ) ;
633+ Assert . Equal ( result . AssemblyCompany , assemblyCompany . Company ) ;
634+ Assert . Equal ( result . AssemblyCopyright , assemblyCopyright . Copyright ) ;
635+ }
636+ else
637+ {
638+ Assert . Null ( assemblyTitle ) ;
639+ Assert . Null ( assemblyProduct ) ;
640+ Assert . Null ( assemblyCompany ) ;
641+ Assert . Null ( assemblyCopyright ) ;
642+ }
626643
627644 const BindingFlags fieldFlags = BindingFlags . Static | BindingFlags . NonPublic ;
628645 Assert . Equal ( result . AssemblyVersion , thisAssemblyClass . GetField ( "AssemblyVersion" , fieldFlags ) . GetValue ( null ) ) ;
629646 Assert . Equal ( result . AssemblyFileVersion , thisAssemblyClass . GetField ( "AssemblyFileVersion" , fieldFlags ) . GetValue ( null ) ) ;
630647 Assert . Equal ( result . AssemblyInformationalVersion , thisAssemblyClass . GetField ( "AssemblyInformationalVersion" , fieldFlags ) . GetValue ( null ) ) ;
631648 Assert . Equal ( result . AssemblyName , thisAssemblyClass . GetField ( "AssemblyName" , fieldFlags ) . GetValue ( null ) ) ;
632649 Assert . Equal ( result . RootNamespace , thisAssemblyClass . GetField ( "RootNamespace" , fieldFlags ) . GetValue ( null ) ) ;
633- Assert . Equal ( result . AssemblyTitle , thisAssemblyClass . GetField ( "AssemblyTitle" , fieldFlags ) . GetValue ( null ) ) ;
634- Assert . Equal ( result . AssemblyProduct , thisAssemblyClass . GetField ( "AssemblyProduct" , fieldFlags ) . GetValue ( null ) ) ;
635- Assert . Equal ( result . AssemblyCompany , thisAssemblyClass . GetField ( "AssemblyCompany" , fieldFlags ) . GetValue ( null ) ) ;
636- Assert . Equal ( result . AssemblyCopyright , thisAssemblyClass . GetField ( "AssemblyCopyright" , fieldFlags ) . GetValue ( null ) ) ;
637650 Assert . Equal ( result . AssemblyConfiguration , thisAssemblyClass . GetField ( "AssemblyConfiguration" , fieldFlags ) . GetValue ( null ) ) ;
651+ if ( includeNonVersionAttributes )
652+ {
653+
654+ Assert . Equal ( result . AssemblyTitle , thisAssemblyClass . GetField ( "AssemblyTitle" , fieldFlags ) . GetValue ( null ) ) ;
655+ Assert . Equal ( result . AssemblyProduct , thisAssemblyClass . GetField ( "AssemblyProduct" , fieldFlags ) . GetValue ( null ) ) ;
656+ Assert . Equal ( result . AssemblyCompany , thisAssemblyClass . GetField ( "AssemblyCompany" , fieldFlags ) . GetValue ( null ) ) ;
657+ Assert . Equal ( result . AssemblyCopyright , thisAssemblyClass . GetField ( "AssemblyCopyright" , fieldFlags ) . GetValue ( null ) ) ;
658+ }
659+ else
660+ {
661+ Assert . Null ( thisAssemblyClass . GetField ( "AssemblyTitle" , fieldFlags ) ) ;
662+ Assert . Null ( thisAssemblyClass . GetField ( "AssemblyProduct" , fieldFlags ) ) ;
663+ Assert . Null ( thisAssemblyClass . GetField ( "AssemblyCompany" , fieldFlags ) ) ;
664+ Assert . Null ( thisAssemblyClass . GetField ( "AssemblyCopyright" , fieldFlags ) ) ;
665+ }
638666
639667 // Verify that it doesn't have key fields
640668 Assert . Null ( thisAssemblyClass . GetField ( "PublicKey" , fieldFlags ) ) ;
0 commit comments