File tree Expand file tree Collapse file tree 7 files changed +73
-1
lines changed
Buildalyzer.Tests/Integration
Buildalyzer.Workspaces.Tests Expand file tree Collapse file tree 7 files changed +73
-1
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ public class BuildalyzerLogger : PipeLogger
1313 public override void Initialize ( IEventSource eventSource )
1414 {
1515 // Parse the parameters
16- string [ ] parameters = Parameters . Split ( ';' ) . Select ( x => x . Trim ( ) ) . ToArray ( ) ;
16+ string [ ] parameters = [ .. ( Parameters ? . Split ( ';' ) . Select ( x => x . Trim ( ) ) ) . OfType < string > ( ) ] ;
1717 if ( parameters . Length != 2 )
1818 {
1919 throw new LoggerException ( "Unexpected number of parameters" ) ;
Original file line number Diff line number Diff line change 1+ using Buildalyzer . Environment ;
2+ using Buildalyzer . TestTools ;
3+ using FluentAssertions ;
4+
5+ namespace Failing_builds ;
6+
7+ public class Analyzer_Build
8+ {
9+ [ Test ]
10+ public void Detects_failing_build_on_single_target ( )
11+ {
12+ using var ctx = Context . ForProject ( @"BuildWithError\BuildWithError.csproj" ) ;
13+ var results = ctx . Analyzer . Build ( new EnvironmentOptions ( ) { DesignTime = false } ) ;
14+
15+ Console . WriteLine ( ctx . Log ) ;
16+
17+ results . OverallSuccess . Should ( ) . BeFalse ( ) ;
18+ results . Should ( ) . AllSatisfy ( r => r . Succeeded . Should ( ) . BeFalse ( ) ) ;
19+ }
20+
21+ [ Test ]
22+ public void Detects_failing_build_on_multi_targets ( )
23+ {
24+ using var ctx = Context . ForProject ( @"BuildWithError\BuildWithError.MultiTarget.csproj" ) ;
25+ var results = ctx . Analyzer . Build ( new EnvironmentOptions ( ) { DesignTime = false } ) ;
26+
27+ Console . WriteLine ( ctx . Log ) ;
28+
29+ results . OverallSuccess . Should ( ) . BeFalse ( ) ;
30+ results . Should ( ) . AllSatisfy ( r => r . Succeeded . Should ( ) . BeFalse ( ) ) ;
31+ }
32+ }
Original file line number Diff line number Diff line change 1+ using Buildalyzer . TestTools ;
2+ using Buildalyzer . Workspaces ;
3+ using FluentAssertions ;
4+ using NUnit . Framework ;
5+
6+ namespace Failing_builds ;
7+
8+ public class Analyzer_Build
9+ {
10+ [ Test ]
11+ public void Detects_failing_build ( )
12+ {
13+ using var ctx = Context . ForProject ( @"BuildWithError\BuildWithError.csproj" ) ;
14+
15+ ctx . Invoking ( c => ctx . Analyzer . GetWorkspace ( ) ) . Should ( ) . NotThrow ( ) ;
16+ }
17+ }
Original file line number Diff line number Diff line change 1+ <Project Sdk =" Microsoft.NET.Sdk" >
2+
3+ <PropertyGroup >
4+ <TargetFrameworks >net6.0;net8.0</TargetFrameworks >
5+ </PropertyGroup >
6+
7+ </Project >
Original file line number Diff line number Diff line change 1+ <Project Sdk =" Microsoft.NET.Sdk" >
2+
3+ <PropertyGroup >
4+ <TargetFramework >net8.0</TargetFramework >
5+ </PropertyGroup >
6+
7+ </Project >
Original file line number Diff line number Diff line change 1+ namespace BuildWithError ;
2+
3+ public class MissingSemiColon
4+ {
5+ public string Name { get ; set }
6+ }
Original file line number Diff line number Diff line change 1+ namespace BuildWithError ;
2+
3+ public class UnclosedClass
You can’t perform that action at this time.
0 commit comments