22using HostApi ;
33using Microsoft . Extensions . DependencyInjection ;
44using NuGet . Versioning ;
5+ // ReSharper disable SeparateLocalFunctionsWithJumpStatement
6+ // ReSharper disable UnusedVariable
57
68// Output, logging and tracing API
79WriteLine ( "Hello" ) ;
5860}
5961
6062// API for .NET CLI
61- var buildResult = new DotNetBuild ( ) . WithConfiguration ( configuration ) . WithNoLogo ( true )
63+ var buildResult = new DotNetBuild ( )
64+ . WithConfiguration ( configuration )
65+ . WithNoLogo ( true )
6266 . Build ( ) . EnsureSuccess ( ) ;
6367
6468var warnings = buildResult . Warnings
7680
7781// Asynchronous way
7882var cts = new CancellationTokenSource ( ) ;
79- /* await new DotNetTest()
83+ await new DotNetTest ( )
8084 . WithConfiguration ( configuration )
81- .WithNoLogo(true).WithNoBuild(true)
82- .BuildAsync(CancellationOnFirstFailedTest, cts.Token )
83- .EnsureSuccess();*/
85+ . WithNoLogo ( true )
86+ . WithNoBuild ( true )
87+ . BuildAsync ( CancellationOnFirstFailedTest , cts . Token ) ;
8488
8589void CancellationOnFirstFailedTest ( BuildMessage message )
8690{
@@ -95,20 +99,35 @@ void CancellationOnFirstFailedTest(BuildMessage message)
9599
96100async Task < IEnumerable < IBuildResult > > RunTestsAsync ( string framework , params string [ ] platforms )
97101{
98- var publish = new DotNetPublish ( ) . WithWorkingDirectory ( "MySampleLib.Tests" )
99- . WithFramework ( $ "net{ framework } ") . WithConfiguration ( configuration ) . WithNoBuild ( true ) ;
102+ var publish = new DotNetPublish ( )
103+ . WithWorkingDirectory ( "MySampleLib.Tests" )
104+ . WithFramework ( $ "net{ framework } ")
105+ . WithConfiguration ( configuration )
106+ . WithNoBuild ( true ) ;
107+
100108 await publish . BuildAsync ( cancellationToken : cts . Token ) . EnsureSuccess ( ) ;
101109 var publishPath = Path . Combine ( publish . WorkingDirectory , "bin" , configuration , $ "net{ framework } ", "publish" ) ;
102110
103- var test = new VSTest ( ) . WithTestFileNames ( "*.Tests.dll" ) ;
104- var testInDocker = new DockerRun ( ) . WithCommandLine ( test ) . WithAutoRemove ( true ) . WithQuiet ( true )
105- . WithVolumes ( ( Path . GetFullPath ( publishPath ) , "/app" ) ) . WithContainerWorkingDirectory ( "/app" ) ;
111+ var test = new VSTest ( )
112+ . WithTestFileNames ( "*.Tests.dll" ) ;
113+
114+ var testInDocker = new DockerRun ( )
115+ . WithCommandLine ( test )
116+ . WithAutoRemove ( true )
117+ . WithQuiet ( true )
118+ . WithVolumes ( ( Path . GetFullPath ( publishPath ) , "/app" ) )
119+ . WithContainerWorkingDirectory ( "/app" ) ;
120+
106121 var tasks = from platform in platforms
107122 let image = $ "mcr.microsoft.com/dotnet/sdk:{ framework } -{ platform } "
108- select testInDocker . WithImage ( image ) . BuildAsync ( CancellationOnFirstFailedTest , cts . Token ) ;
123+ select testInDocker
124+ . WithImage ( image )
125+ . BuildAsync ( CancellationOnFirstFailedTest , cts . Token ) ;
109126 return await Task . WhenAll ( tasks ) ;
110127}
111128
112129#pragma warning disable CS9113 // Parameter is unread.
113- class MyTool ( INuGet nuGet ) ;
130+
131+ internal class MyTool ( INuGet nuGet ) ;
132+
114133#pragma warning restore CS9113// Parameter is unread.
0 commit comments