@@ -4,6 +4,22 @@ namespace TestContainers.Build;
44public class BuildContext ( ICakeContext context ) : FrostingContext ( context )
55{
66 internal BuildParameters Parameters { get ; } = BuildParameters . Instance ( context ) ;
7+
8+ public void DotNetTest ( SolutionProject project )
9+ {
10+ this . DotNetTest ( project . Path . FullPath , new DotNetTestSettings
11+ {
12+ Configuration = Parameters . Configuration ,
13+ Verbosity = Parameters . Verbosity ,
14+ NoRestore = true ,
15+ NoBuild = true ,
16+ Collectors = [ "XPlat Code Coverage;Format=opencover" ] ,
17+ Filter = Parameters . TestFilter ,
18+ ResultsDirectory = Parameters . Paths . Directories . TestResultsDirectoryPath ,
19+ ArgumentCustomization = args => args
20+ . AppendSwitchQuoted ( "--blame-hang-timeout" , "5m" )
21+ } ) ;
22+ }
723}
824
925[ UsedImplicitly ]
@@ -95,18 +111,7 @@ public override void Run(BuildContext context)
95111 var testProject = param . Projects . OnlyTests
96112 . Single ( testProject => testProject . Path . FullPath . EndsWith ( param . TestProject + ".Tests.csproj" ) ) ;
97113
98- context . DotNetTest ( testProject . Path . FullPath , new DotNetTestSettings
99- {
100- Configuration = param . Configuration ,
101- Verbosity = param . Verbosity ,
102- NoRestore = true ,
103- NoBuild = true ,
104- Collectors = [ "XPlat Code Coverage;Format=opencover" ] ,
105- Filter = param . TestFilter ,
106- ResultsDirectory = param . Paths . Directories . TestResultsDirectoryPath ,
107- ArgumentCustomization = args => args
108- . AppendSwitchQuoted ( "--blame-hang-timeout" , "5m" )
109- } ) ;
114+ context . DotNetTest ( testProject ) ;
110115 }
111116}
112117
@@ -118,18 +123,7 @@ public override void Run(BuildContext context)
118123 var param = context . Parameters ;
119124 foreach ( var testProject in param . Projects . OnlyTests )
120125 {
121- context . DotNetTest ( testProject . Path . FullPath , new DotNetTestSettings
122- {
123- Configuration = param . Configuration ,
124- Verbosity = param . Verbosity ,
125- NoRestore = true ,
126- NoBuild = true ,
127- Collectors = [ "XPlat Code Coverage;Format=opencover" ] ,
128- Filter = param . TestFilter ,
129- ResultsDirectory = param . Paths . Directories . TestResultsDirectoryPath ,
130- ArgumentCustomization = args => args
131- . AppendSwitchQuoted ( "--blame-hang-timeout" , "5m" )
132- } ) ;
126+ context . DotNetTest ( testProject ) ;
133127 }
134128 }
135129}
0 commit comments