@@ -71,14 +71,14 @@ public void CacheFileExistsOnDisk()
7171
7272 var versionAndBranchFinder = new ExecuteCore ( fileSystem ) ;
7373
74- var info = RepositoryScope ( versionAndBranchFinder , ( fixture , vv ) =>
74+ var logs = RepositoryScope ( versionAndBranchFinder , ( fixture , vv ) =>
7575 {
7676 fileSystem . WriteAllText ( vv . FileName , versionCacheFileContent ) ;
7777 vv = versionAndBranchFinder . ExecuteGitVersion ( null , null , null , null , false , fixture . RepositoryPath , null ) ;
7878 vv . AssemblySemVer . ShouldBe ( "4.10.3.0" ) ;
7979 } ) ;
8080
81- info . ShouldContain ( "Deserializing version variables from cache file" , ( ) => info ) ;
81+ logs . Info . ShouldContain ( "Deserializing version variables from cache file" , ( ) => logs . Info ) ;
8282 }
8383
8484
@@ -139,8 +139,8 @@ public void CacheFileExistsOnDiskWhenOverrideConfigIsSpecifiedVersionShouldBeDyn
139139 [ Test ]
140140 public void CacheFileIsMissing ( )
141141 {
142- var info = RepositoryScope ( ) ;
143- info . ShouldContain ( "yml not found" , ( ) => info ) ;
142+ var logsMessages = RepositoryScope ( ) ;
143+ logsMessages . Info . ShouldContain ( "yml not found" , ( ) => logsMessages . Info ) ;
144144 }
145145
146146
@@ -260,19 +260,34 @@ public void DynamicRepositoriesShouldNotErrorWithFailedToFindGitDirectory()
260260 } ) ;
261261 }
262262
263- string RepositoryScope ( ExecuteCore executeCore = null , Action < EmptyRepositoryFixture , VersionVariables > fixtureAction = null )
263+ LogMessages RepositoryScope ( ExecuteCore executeCore = null , Action < EmptyRepositoryFixture , VersionVariables > fixtureAction = null )
264264 {
265265 // Make sure GitVersion doesn't trigger build server mode when we are running the tests
266266 Environment . SetEnvironmentVariable ( AppVeyor . EnvironmentVariableName , null ) ;
267267 Environment . SetEnvironmentVariable ( TravisCI . EnvironmentVariableName , null ) ;
268+ var debugBuilder = new StringBuilder ( ) ;
269+ Action < string > debugLogger = s =>
270+ {
271+ debugBuilder . AppendLine ( s ) ;
272+ } ;
268273 var infoBuilder = new StringBuilder ( ) ;
269274 Action < string > infoLogger = s =>
270275 {
271276 infoBuilder . AppendLine ( s ) ;
272277 } ;
278+ var warnBuilder = new StringBuilder ( ) ;
279+ Action < string > warnLogger = s =>
280+ {
281+ warnBuilder . AppendLine ( s ) ;
282+ } ;
283+ var errorBuilder = new StringBuilder ( ) ;
284+ Action < string > errorLogger = s =>
285+ {
286+ errorBuilder . AppendLine ( s ) ;
287+ } ;
273288 executeCore = executeCore ?? new ExecuteCore ( fileSystem ) ;
274289
275- using ( Logger . AddLoggersTemporarily ( infoLogger , s => { } , s => { } ) )
290+ using ( Logger . AddLoggersTemporarily ( debugLogger , infoLogger , warnLogger , errorLogger ) )
276291 using ( var fixture = new EmptyRepositoryFixture ( ) )
277292 {
278293 fixture . Repository . MakeACommit ( ) ;
@@ -287,6 +302,12 @@ string RepositoryScope(ExecuteCore executeCore = null, Action<EmptyRepositoryFix
287302 }
288303 }
289304
290- return infoBuilder . ToString ( ) ;
305+ return new LogMessages
306+ {
307+ Debug = debugBuilder . ToString ( ) ,
308+ Info = infoBuilder . ToString ( ) ,
309+ Warn = warnBuilder . ToString ( ) ,
310+ Error = errorBuilder . ToString ( )
311+ } ;
291312 }
292313}
0 commit comments