@@ -976,12 +976,11 @@ Microsoft.NETCore.App 2.1.3 [/usr/local/share/dotnet/shared/Microsoft.NETCore.Ap
976
976
TestAutobuilderScript ( autobuilder , 0 , 9 ) ;
977
977
}
978
978
979
- [ Fact ]
980
- public void TestDotnetVersionWindows ( )
979
+ private void TestDotnetVersionWindows ( Action action , int commandsRun )
981
980
{
982
981
actions . RunProcess [ "cmd.exe /C dotnet --list-sdks" ] = 0 ;
983
982
actions . RunProcessOut [ "cmd.exe /C dotnet --list-sdks" ] = "2.1.3 [C:\\ Program Files\\ dotnet\\ sdks]\n 2.1.4 [C:\\ Program Files\\ dotnet\\ sdks]" ;
984
- actions . RunProcess [ @"cmd.exe /C pwsh -NoProfile -ExecutionPolicy unrestricted -Command ""[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; &([scriptblock]::Create((Invoke-WebRequest -UseBasicParsing 'https://dot.net/v1/dotnet-install.ps1'))) -Version 2.1.3 -InstallDir C:\Project\.dotnet""" ] = 0 ;
983
+ action ( ) ;
985
984
actions . RunProcess [ @"cmd.exe /C C:\Project\.dotnet\dotnet --info" ] = 0 ;
986
985
actions . RunProcess [ @"cmd.exe /C C:\Project\.dotnet\dotnet clean C:\Project\test.csproj" ] = 0 ;
987
986
actions . RunProcess [ @"cmd.exe /C C:\Project\.dotnet\dotnet restore C:\Project\test.csproj" ] = 0 ;
@@ -1004,39 +1003,28 @@ public void TestDotnetVersionWindows()
1004
1003
actions . LoadXml [ @"C:\Project\test.csproj" ] = xml ;
1005
1004
1006
1005
var autobuilder = CreateAutoBuilder ( true , dotnetVersion : "2.1.3" ) ;
1007
- TestAutobuilderScript ( autobuilder , 0 , 6 ) ;
1006
+ TestAutobuilderScript ( autobuilder , 0 , commandsRun ) ;
1008
1007
}
1009
1008
1010
1009
[ Fact ]
1011
- public void TestDotnetVersionWindowsNoPwsh ( )
1010
+ public void TestDotnetVersionWindowsWithPwsh ( )
1012
1011
{
1013
- actions . RunProcess [ "cmd.exe /C dotnet --list-sdks" ] = 0 ;
1014
- actions . RunProcessOut [ "cmd.exe /C dotnet --list-sdks" ] = "2.1.3 [C:\\ Program Files\\ dotnet\\ sdks]\n 2.1.4 [C:\\ Program Files\\ dotnet\\ sdks]" ;
1015
- actions . RunProcess [ @"cmd.exe /C pwsh -NoProfile -ExecutionPolicy unrestricted -Command ""[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; &([scriptblock]::Create((Invoke-WebRequest -UseBasicParsing 'https://dot.net/v1/dotnet-install.ps1'))) -Version 2.1.3 -InstallDir C:\Project\.dotnet""" ] = 1 ;
1016
- actions . RunProcess [ @"cmd.exe /C powershell -NoProfile -ExecutionPolicy unrestricted -Command ""[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; &([scriptblock]::Create((Invoke-WebRequest -UseBasicParsing 'https://dot.net/v1/dotnet-install.ps1'))) -Version 2.1.3 -InstallDir C:\Project\.dotnet""" ] = 0 ;
1017
- actions . RunProcess [ @"cmd.exe /C C:\Project\.dotnet\dotnet --info" ] = 0 ;
1018
- actions . RunProcess [ @"cmd.exe /C C:\Project\.dotnet\dotnet clean C:\Project\test.csproj" ] = 0 ;
1019
- actions . RunProcess [ @"cmd.exe /C C:\Project\.dotnet\dotnet restore C:\Project\test.csproj" ] = 0 ;
1020
- actions . RunProcess [ @"cmd.exe /C C:\odasa\tools\odasa index --auto C:\Project\.dotnet\dotnet build --no-incremental C:\Project\test.csproj" ] = 0 ;
1021
- actions . FileExists [ "csharp.log" ] = true ;
1022
- actions . FileExists [ @"C:\Project\test.csproj" ] = true ;
1023
- actions . GetEnvironmentVariable [ "CODEQL_EXTRACTOR_CSHARP_TRAP_DIR" ] = "" ;
1024
- actions . GetEnvironmentVariable [ "CODEQL_EXTRACTOR_CSHARP_SOURCE_ARCHIVE_DIR" ] = "" ;
1025
- actions . GetEnvironmentVariable [ "PATH" ] = "/bin:/usr/bin" ;
1026
- actions . EnumerateFiles [ @"C:\Project" ] = "foo.cs\n test.cs\n test.csproj" ;
1027
- actions . EnumerateDirectories [ @"C:\Project" ] = "" ;
1028
- var xml = new XmlDocument ( ) ;
1029
- xml . LoadXml ( @"<Project Sdk=""Microsoft.NET.Sdk"">
1030
- <PropertyGroup>
1031
- <OutputType>Exe</OutputType>
1032
- <TargetFramework>netcoreapp2.1</TargetFramework>
1033
- </PropertyGroup>
1034
-
1035
- </Project>" ) ;
1036
- actions . LoadXml [ @"C:\Project\test.csproj" ] = xml ;
1012
+ TestDotnetVersionWindows ( ( ) =>
1013
+ {
1014
+ actions . RunProcess [ @"cmd.exe /C pwsh -NoProfile -ExecutionPolicy unrestricted -Command ""[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; &([scriptblock]::Create((Invoke-WebRequest -UseBasicParsing 'https://dot.net/v1/dotnet-install.ps1'))) -Version 2.1.3 -InstallDir C:\Project\.dotnet""" ] = 0 ;
1015
+ } ,
1016
+ 6 ) ;
1017
+ }
1037
1018
1038
- var autobuilder = CreateAutoBuilder ( true , dotnetVersion : "2.1.3" ) ;
1039
- TestAutobuilderScript ( autobuilder , 0 , 7 ) ;
1019
+ [ Fact ]
1020
+ public void TestDotnetVersionWindowsWithoutPwsh ( )
1021
+ {
1022
+ TestDotnetVersionWindows ( ( ) =>
1023
+ {
1024
+ actions . RunProcess [ @"cmd.exe /C pwsh -NoProfile -ExecutionPolicy unrestricted -Command ""[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; &([scriptblock]::Create((Invoke-WebRequest -UseBasicParsing 'https://dot.net/v1/dotnet-install.ps1'))) -Version 2.1.3 -InstallDir C:\Project\.dotnet""" ] = 1 ;
1025
+ actions . RunProcess [ @"cmd.exe /C powershell -NoProfile -ExecutionPolicy unrestricted -Command ""[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; &([scriptblock]::Create((Invoke-WebRequest -UseBasicParsing 'https://dot.net/v1/dotnet-install.ps1'))) -Version 2.1.3 -InstallDir C:\Project\.dotnet""" ] = 0 ;
1026
+ } ,
1027
+ 7 ) ;
1040
1028
}
1041
1029
1042
1030
[ Fact ]
0 commit comments