Fix test failures due to changes in .NET Core and the exclusion of 'Certificate' provider in UNIX PS

This commit is contained in:
Dongbo Wang
2016-10-14 10:02:44 -07:00
committed by Mike Richmond
parent f02b6ef97a
commit 139b399223
4 changed files with 23 additions and 14 deletions
@@ -47,6 +47,14 @@ Describe "Redirection operator now supports encoding changes" -Tags "CI" {
$availableEncodings = (get-command out-file).Parameters["Encoding"].Attributes.ValidValues
foreach($encoding in $availableEncodings) {
if ($encoding -eq "default") {
# [System.Text.Encoding]::Default is exposed by 'System.Private.CoreLib.dll' at
# runtime via reflection. However,it isn't exposed in the reference contract of
# 'System.Text.Encoding', and therefore we cannot use 'Encoding.Default' in our
# code. So we need to skip this encoding in the test.
continue
}
# some of the encodings accepted by out-file aren't real,
# and out-file has its own translation, so we'll
# not do that logic here, but simply ignore those encodings
@@ -23,17 +23,18 @@ Describe "Get-PSDrive" -Tags "CI" {
}
It "Should return drive info"{
(Get-PSDrive Env).Name | Should Be Env
(Get-PSDrive Cert).Root | Should Be \
(Get-PSDrive Env).Name | Should Be Env
(Get-PSDrive Alias).Name | Should Be Alias
if ($IsWindows)
{
(Get-PSDrive C).Provider.Name | Should Be FileSystem
}
else
{
(Get-PSDrive /).Provider.Name | Should Be FileSystem
}
if ($IsWindows)
{
(Get-PSDrive Cert).Root | Should Be \
(Get-PSDrive C).Provider.Name | Should Be FileSystem
}
else
{
(Get-PSDrive /).Provider.Name | Should Be FileSystem
}
}
It "Should be able to access a drive using the PSProvider switch" {
@@ -29,7 +29,7 @@
$testCases += [TestData]::new("PS1", $ps1File, [NullString]::Value)
$testCases += [TestData]::new("Empty string", "", "ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.ExportAliasCommand")
$testCases += [TestData]::new("Null", [NullString]::Value, "ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.ExportAliasCommand")
$testCases += [TestData]::new("Non filesystem provider", 'cert:\alias.ps1', "ReadWriteFileNotFileSystemProvider,Microsoft.PowerShell.Commands.ExportAliasCommand")
$testCases += [TestData]::new("Non filesystem provider", 'env:\alias.ps1', "ReadWriteFileNotFileSystemProvider,Microsoft.PowerShell.Commands.ExportAliasCommand")
}
$testCases | % {
@@ -116,7 +116,7 @@
$testCases = @()
$testCases += [TestData]::new("Empty string", "", "ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.ImportAliasCommand")
$testCases += [TestData]::new("Null", [NullString]::Value, "ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.ImportAliasCommand")
$testCases += [TestData]::new("Non filesystem provider", 'cert:\alias.ps1', "NotSupported,Microsoft.PowerShell.Commands.ImportAliasCommand")
$testCases += [TestData]::new("Non filesystem provider", 'env:\alias.ps1', "NotSupported,Microsoft.PowerShell.Commands.ImportAliasCommand")
}
$testCases | % {
@@ -44,7 +44,7 @@
$testData = @()
$testData += [TestData]::new("with path as Null", [NullString]::Value, $gps, "ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.ExportClixmlCommand")
$testData += [TestData]::new("with path as Empty string", "", $gps, "ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.ExportClixmlCommand")
$testData += [TestData]::new("with path as non filesystem provider", "cert:\", $gps, "ReadWriteFileNotFileSystemProvider,Microsoft.PowerShell.Commands.ExportClixmlCommand")
$testData += [TestData]::new("with path as non filesystem provider", "env:\", $gps, "ReadWriteFileNotFileSystemProvider,Microsoft.PowerShell.Commands.ExportClixmlCommand")
}
AfterEach {
@@ -132,7 +132,7 @@
$testData = @()
$testData += [TestData]::new("with path as Null", [NullString]::Value, $null, "ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.ImportClixmlCommand")
$testData += [TestData]::new("with path as Empty string", "", $null, "ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.ImportClixmlCommand")
$testData += [TestData]::new("with path as non filesystem provider", "cert:\", $null, "ReadWriteFileNotFileSystemProvider,Microsoft.PowerShell.Commands.ImportClixmlCommand")
$testData += [TestData]::new("with path as non filesystem provider", "env:\", $null, "ReadWriteFileNotFileSystemProvider,Microsoft.PowerShell.Commands.ImportClixmlCommand")
}
$testData | % {