Files
runner-images-PK/images/windows/scripts/tests/DotnetSDK.Tests.ps1
T

35 lines
1.1 KiB
PowerShell
Raw Normal View History

2020-11-11 16:22:17 +03:00
$dotnetVersions = (Get-ToolsetContent).dotnet.versions
2022-01-18 13:31:51 +00:00
$dotnetTools = (Get-ToolsetContent).dotnet.tools
2022-01-18 13:31:51 +00:00
Describe "Dotnet SDK and tools" {
Context "Default" {
It "Default Dotnet SDK is available" {
"dotnet --version" | Should -ReturnZeroExitCode
}
}
foreach ($version in $dotnetVersions) {
Context "Dotnet $version" {
$dotnet = @{ dotnetVersion = $version }
It "SDK $version is available" -TestCases $dotnet {
(dotnet --list-sdks | Where-Object { $_ -match "${dotnetVersion}\.[0-9]*" }).Count | Should -BeGreaterThan 0
}
It "Runtime $version is available" -TestCases $dotnet {
(dotnet --list-runtimes | Where-Object { $_ -match "${dotnetVersion}\.[0-9]*" }).Count | Should -BeGreaterThan 0
}
}
}
2022-01-18 13:31:51 +00:00
Context "Dotnet tools" {
2022-01-29 13:00:14 +03:00
$env:Path += ";C:\Users\Default\.dotnet\tools"
2022-01-18 13:31:51 +00:00
$testCases = $dotnetTools | ForEach-Object { @{ ToolName = $_.name; TestInstance = $_.test }}
It "<ToolName> is available" -TestCases $testCases {
"$TestInstance" | Should -ReturnZeroExitCode
}
}
}