Merge pull request #2063 from jsoref/spelling-test

spelling fixes: tests
This commit is contained in:
Sergei Vorobev 2016-08-31 14:13:49 -07:00 committed by GitHub
commit 1638bdf3e6
38 changed files with 96 additions and 96 deletions

View file

@ -201,7 +201,7 @@ namespace PSTests
} }
[Fact] [Fact]
public static void TestNonExistantIsHardLink() public static void TestNonExistentIsHardLink()
{ {
// A file that should *never* exist on a test machine: // A file that should *never* exist on a test machine:
string path = @"/tmp/ThisFileShouldNotExistOnTestMachines"; string path = @"/tmp/ThisFileShouldNotExistOnTestMachines";

View file

@ -76,10 +76,10 @@ namespace PSTests
Assert.Equal(FileSystemProvider.Mode(null),String.Empty); Assert.Equal(FileSystemProvider.Mode(null),String.Empty);
FileSystemInfo directoryObject = new DirectoryInfo(@"/"); FileSystemInfo directoryObject = new DirectoryInfo(@"/");
FileSystemInfo fileObject = new FileInfo(@"/etc/hosts"); FileSystemInfo fileObject = new FileInfo(@"/etc/hosts");
FileSystemInfo excutableObject = new FileInfo(@"/bin/echo"); FileSystemInfo executableObject = new FileInfo(@"/bin/echo");
Assert.Equal(FileSystemProvider.Mode(PSObject.AsPSObject(directoryObject)).Replace("r","-"),"d-----"); Assert.Equal(FileSystemProvider.Mode(PSObject.AsPSObject(directoryObject)).Replace("r","-"),"d-----");
Assert.Equal(FileSystemProvider.Mode(PSObject.AsPSObject(fileObject)).Replace("r","-"),"------"); Assert.Equal(FileSystemProvider.Mode(PSObject.AsPSObject(fileObject)).Replace("r","-"),"------");
Assert.Equal(FileSystemProvider.Mode(PSObject.AsPSObject(excutableObject)).Replace("r","-"),"------"); Assert.Equal(FileSystemProvider.Mode(PSObject.AsPSObject(executableObject)).Replace("r","-"),"------");
} }
[Fact] [Fact]

View file

@ -165,7 +165,7 @@ Describe "ConsoleHost unit tests" -tags "Feature" {
# even though it is redirected - we want to make sure we don't hang. # even though it is redirected - we want to make sure we don't hang.
# So none of these tests should close StandardInput # So none of these tests should close StandardInput
It "Redirected input w/ implict -Command w/ -NonInteractive" { It "Redirected input w/ implicit -Command w/ -NonInteractive" {
$si = NewProcessStartInfo "-NonInteractive -noprofile 1+1" -RedirectStdIn $si = NewProcessStartInfo "-NonInteractive -noprofile 1+1" -RedirectStdIn
$process = RunPowerShell $si $process = RunPowerShell $si
$process.StandardOutput.ReadToEnd() | Should Be 2 $process.StandardOutput.ReadToEnd() | Should Be 2
@ -179,7 +179,7 @@ Describe "ConsoleHost unit tests" -tags "Feature" {
EnsureChildHasExited $process EnsureChildHasExited $process
} }
It "Redirected input w/ explict -Command w/ -NonInteractive" { It "Redirected input w/ explicit -Command w/ -NonInteractive" {
$si = NewProcessStartInfo "-NonInteractive -noprofile -Command 1+1" -RedirectStdIn $si = NewProcessStartInfo "-NonInteractive -noprofile -Command 1+1" -RedirectStdIn
$process = RunPowerShell $si $process = RunPowerShell $si
$process.StandardOutput.ReadToEnd() | Should Be 2 $process.StandardOutput.ReadToEnd() | Should Be 2
@ -214,7 +214,7 @@ Describe "ConsoleHost unit tests" -tags "Feature" {
$nl = [Environment]::Newline $nl = [Environment]::Newline
# All of the following tests replace the prompt (either via an initial command or interactively) # All of the following tests replace the prompt (either via an initial command or interactively)
# so that we can read StandardOutput and realiably know exactly what the prompt is. # so that we can read StandardOutput and reliably know exactly what the prompt is.
It "Interactive redirected input" { It "Interactive redirected input" {
$si = NewProcessStartInfo "-noprofile -nologo" -RedirectStdIn $si = NewProcessStartInfo "-noprofile -nologo" -RedirectStdIn

View file

@ -38,7 +38,7 @@ class A
$errors[0].ErrorId | Should be 'LabelNotFound' $errors[0].ErrorId | Should be 'LabelNotFound'
} }
It 'work fine, when break is legite' { It 'work fine, when break is legit' {
class C class C
{ {
static [int] foo() static [int] foo()

View file

@ -464,7 +464,7 @@ Describe 'Classes inheritance ctors' -Tags "CI" {
'' | Should Be "Exception expected" '' | Should Be "Exception expected"
} }
It 'allow use convertion [string -> int] in base ctor call' { It 'allow use conversion [string -> int] in base ctor call' {
class A { class A {
[int]$a [int]$a
A([int]$a) A([int]$a)

View file

@ -82,7 +82,7 @@ class Bar : Foo.Foo {}
It "can use modules with classes collision" { It "can use modules with classes collision" {
# we use 3 classes with name Foo at the same time # we use 3 classes with name Foo at the same time
# two of them come from 'using module' and one is defined in the scriptblock itself. # two of them come from 'using module' and one is defined in the scriptblock itself.
# we should be able to use first two of them by the module-quilified name and the third one it's name. # we should be able to use first two of them by the module-qualified name and the third one it's name.
$fooModuleName = [scriptblock]::Create(@" $fooModuleName = [scriptblock]::Create(@"
using module Foo using module Foo
using module FooWithManifest using module FooWithManifest
@ -106,7 +106,7 @@ class Bar : Foo {}
$fooModuleName[3] | Should Be 'This' $fooModuleName[3] | Should Be 'This'
} }
It "doesn't mess up two consequitive scripts" { It "doesn't mess up two consecutive scripts" {
$sb1 = [scriptblock]::Create(@" $sb1 = [scriptblock]::Create(@"
using module Foo using module Foo
class Bar : Foo {} class Bar : Foo {}
@ -324,7 +324,7 @@ using module Foo
New-TestModule -Manifest -Name FooWithManifest -Content 'class Foo { [string] GetModuleName() { return "Foo345" } }' -Version '3.4.5' -ModulePathPrefix 'Modules2' New-TestModule -Manifest -Name FooWithManifest -Content 'class Foo { [string] GetModuleName() { return "Foo345" } }' -Version '3.4.5' -ModulePathPrefix 'Modules2'
} }
# 'using module' behavior must be alligned with Import-Module. # 'using module' behavior must be aligned with Import-Module.
# Import-Module does the following: # Import-Module does the following:
# 1) find the first directory from $env:PSMODULEPATH that contains the module # 1) find the first directory from $env:PSMODULEPATH that contains the module
# 2) Import highest available version of the module # 2) Import highest available version of the module

View file

@ -191,7 +191,7 @@ Describe "Test class based extensible completion" -Tags "CI" {
} | Get-CompletionTestCaseData | Test-Completions } | Get-CompletionTestCaseData | Test-Completions
} }
Describe "Test registration based exensible completion" -Tags "CI" { Describe "Test registration based extensible completion" -Tags "CI" {
Register-ArgumentCompleter -Command TestFunction -Parameter Gamma -ScriptBlock { Register-ArgumentCompleter -Command TestFunction -Parameter Gamma -ScriptBlock {
param( param(
[string] $CommandName, [string] $CommandName,

View file

@ -593,7 +593,7 @@ Describe "Test suite for Microsoft.PowerShell.Archive module" -Tags "CI" {
ArchiveFileEntryContentValidator "$destinationPath" ([io.path]::Combine("SourceDir","ChildDir-1","Sample-3.txt")) $modifiedContent ArchiveFileEntryContentValidator "$destinationPath" ([io.path]::Combine("SourceDir","ChildDir-1","Sample-3.txt")) $modifiedContent
} }
It "Validate Compress-Archive cmdlet in pipleline scenario" { It "Validate Compress-Archive cmdlet in pipeline scenario" {
$destinationPath = "$TestDrive/CompressArchiveFromPipeline.zip" $destinationPath = "$TestDrive/CompressArchiveFromPipeline.zip"
# Piping a single file path to Compress-Archive # Piping a single file path to Compress-Archive
@ -878,7 +878,7 @@ Describe "Test suite for Microsoft.PowerShell.Archive module" -Tags "CI" {
Compare-Object -ReferenceObject $extractedList -DifferenceObject $sourceList -PassThru | Should Be $null Compare-Object -ReferenceObject $extractedList -DifferenceObject $sourceList -PassThru | Should Be $null
} }
It "Validate Expand-Archive cmdlet in pipleline scenario" { It "Validate Expand-Archive cmdlet in pipeline scenario" {
$sourcePath = "$TestDrive/SamplePreCreated*.zip" $sourcePath = "$TestDrive/SamplePreCreated*.zip"
$destinationPath = "$TestDrive/PipeToExpandArchive" $destinationPath = "$TestDrive/PipeToExpandArchive"

View file

@ -87,7 +87,7 @@
$ps.Streams.Information).Count $ps.Streams.Information).Count
$ps.Dispose() $ps.Dispose()
## Twice per stream - once for the original invocatgion, and once for the re-invocation ## Twice per stream - once for the original invocation, and once for the re-invocation
$outputCount | Should be 12 $outputCount | Should be 12
} }

View file

@ -9,34 +9,34 @@
BeforeEach { BeforeEach {
Remove-EventLog -LogName TestLog -ea Ignore Remove-EventLog -LogName TestLog -ea Ignore
} }
It "should be able to create a New-EventLog with a -Source paramter" -Skip:($True -Or $NonWinAdmin) { It "should be able to create a New-EventLog with a -Source parameter" -Skip:($True -Or $NonWinAdmin) {
{New-EventLog -LogName TestLog -Source TestSource -ea stop} | Should Not Throw {New-EventLog -LogName TestLog -Source TestSource -ea stop} | Should Not Throw
{Write-EventLog -LogName TestLog -Source TestSource -Message "Test" -EventID 1 -ea stop} | Should Not Throw {Write-EventLog -LogName TestLog -Source TestSource -Message "Test" -EventID 1 -ea stop} | Should Not Throw
$result=Get-EventLog -LogName TestLog $result=Get-EventLog -LogName TestLog
$result.Count | Should be 1 $result.Count | Should be 1
} }
It "should be able to create a New-EventLog with a -ComputerName paramter" -Skip:($True -Or $NonWinAdmin) { It "should be able to create a New-EventLog with a -ComputerName parameter" -Skip:($True -Or $NonWinAdmin) {
{New-EventLog -LogName TestLog -Source TestSource -ComputerName $env:COMPUTERNAME -ea stop} | Should Not Throw {New-EventLog -LogName TestLog -Source TestSource -ComputerName $env:COMPUTERNAME -ea stop} | Should Not Throw
{Write-EventLog -LogName TestLog -Source TestSource -Message "Test" -EventID 1 -ea stop} | Should Not Throw {Write-EventLog -LogName TestLog -Source TestSource -Message "Test" -EventID 1 -ea stop} | Should Not Throw
$result=Get-EventLog -LogName TestLog $result=Get-EventLog -LogName TestLog
$result.Count | Should be 1 $result.Count | Should be 1
$result.EventID | Should be 1 $result.EventID | Should be 1
} }
It "should be able to create a New-EventLog with a -CategoryResourceFile paramter" -Skip:($True -Or $NonWinAdmin) { It "should be able to create a New-EventLog with a -CategoryResourceFile parameter" -Skip:($True -Or $NonWinAdmin) {
{New-EventLog -LogName TestLog -Source TestSource -CategoryResourceFile "CategoryMessageFile" -ea stop} | Should Not Throw {New-EventLog -LogName TestLog -Source TestSource -CategoryResourceFile "CategoryMessageFile" -ea stop} | Should Not Throw
{Write-EventLog -LogName TestLog -Source TestSource -Message "Test" -EventID 2 -ea stop} | Should Not Throw {Write-EventLog -LogName TestLog -Source TestSource -Message "Test" -EventID 2 -ea stop} | Should Not Throw
$result=Get-EventLog -LogName TestLog $result=Get-EventLog -LogName TestLog
$result.Count | Should be 1 $result.Count | Should be 1
$result.EventID | Should be 2 $result.EventID | Should be 2
} }
It "should be able to create a New-EventLog with a -MessageResourceFile paramter" -Skip:($True -Or $NonWinAdmin) { It "should be able to create a New-EventLog with a -MessageResourceFile parameter" -Skip:($True -Or $NonWinAdmin) {
{New-EventLog -LogName TestLog -Source TestSource -MessageResourceFile "ResourceMessageFile" -ea stop} | Should Not Throw {New-EventLog -LogName TestLog -Source TestSource -MessageResourceFile "ResourceMessageFile" -ea stop} | Should Not Throw
{Write-EventLog -LogName TestLog -Source TestSource -Message "Test" -EventID 3 -ea stop} | Should Not Throw {Write-EventLog -LogName TestLog -Source TestSource -Message "Test" -EventID 3 -ea stop} | Should Not Throw
$result=Get-EventLog -LogName TestLog $result=Get-EventLog -LogName TestLog
$result.Count | Should be 1 $result.Count | Should be 1
$result.EventID | Should be 3 $result.EventID | Should be 3
} }
It "should be able to create a New-EventLog with a -ParameterResourceFile paramter" -Skip:($True -Or $NonWinAdmin) { It "should be able to create a New-EventLog with a -ParameterResourceFile parameter" -Skip:($True -Or $NonWinAdmin) {
{New-EventLog -LogName TestLog -Source TestSource -ParameterResourceFile "ParameterMessageFile" -ea stop} | Should Not Throw {New-EventLog -LogName TestLog -Source TestSource -ParameterResourceFile "ParameterMessageFile" -ea stop} | Should Not Throw
{Write-EventLog -LogName TestLog -Source TestSource -Message "Test" -EventID 4 -ea stop} | Should Not Throw {Write-EventLog -LogName TestLog -Source TestSource -Message "Test" -EventID 4 -ea stop} | Should Not Throw
$result=Get-EventLog -LogName TestLog $result=Get-EventLog -LogName TestLog

View file

@ -8,8 +8,8 @@ Describe "Test-Path" -Tags "CI" {
New-Item -Path $testdirectory -Name gatestfile -value 1 -ItemType file | Out-Null New-Item -Path $testdirectory -Name gatestfile -value 1 -ItemType file | Out-Null
New-Item -Path $testdirectory -Name usr -value 1 -ItemType directory | Out-Null New-Item -Path $testdirectory -Name usr -value 1 -ItemType directory | Out-Null
$nonExistantDir = Join-Path -Path (Join-Path -Path $testdirectory -ChildPath usr) -ChildPath bin $nonExistentDir = Join-Path -Path (Join-Path -Path $testdirectory -ChildPath usr) -ChildPath bin
$nonExistantPath = Join-Path -Path (Join-Path -Path (Join-Path -Path $testdirectory -ChildPath usr) -ChildPath bin) -ChildPath error $nonExistentPath = Join-Path -Path (Join-Path -Path (Join-Path -Path $testdirectory -ChildPath usr) -ChildPath bin) -ChildPath error
} }
It "Should be called on an existing path without error" { It "Should be called on an existing path without error" {
@ -22,15 +22,15 @@ Describe "Test-Path" -Tags "CI" {
{ $testdirectory | Test-Path } | Should Not Throw { $testdirectory | Test-Path } | Should Not Throw
$testdirectory | Test-Path | Should Be $true $testdirectory | Test-Path | Should Be $true
$nonExistantDir | Test-Path | Should Be $false $nonExistentDir | Test-Path | Should Be $false
} }
It "Should be called on a nonexistant path without error" { It "Should be called on a nonexistent path without error" {
{ Test-Path -Path $nonExistantPath } | Should Not Throw { Test-Path -Path $nonExistentPath } | Should Not Throw
} }
It "Should return false for a nonexistant path" { It "Should return false for a nonexistent path" {
Test-Path -Path $nonExistantPath | Should Be $false Test-Path -Path $nonExistentPath | Should Be $false
} }
It "Should return true for an existing path" { It "Should return true for an existing path" {
@ -58,7 +58,7 @@ Describe "Test-Path" -Tags "CI" {
Test-Path -Path $testfilename -PathType Leaf | Should Be $true Test-Path -Path $testfilename -PathType Leaf | Should Be $true
} }
It "Should return false when the Leaf pathtype is used on a nonexistant file" { It "Should return false when the Leaf pathtype is used on a nonexistent file" {
Test-Path -Path "aoeu" -PathType Leaf | Should Be $false Test-Path -Path "aoeu" -PathType Leaf | Should Be $false
} }
@ -80,7 +80,7 @@ Describe "Test-Path" -Tags "CI" {
} }
It "Should return true if the syntax of the path is correct when using the IsValid switch" { It "Should return true if the syntax of the path is correct when using the IsValid switch" {
{ Test-Path -Path $nonExistantPath -IsValid } | Should Be $true { Test-Path -Path $nonExistentPath -IsValid } | Should Be $true
} }
It "Should return false if the syntax of the path is incorrect when using the IsValid switch" { It "Should return false if the syntax of the path is incorrect when using the IsValid switch" {

View file

@ -8,7 +8,7 @@
-------------------------------------- --------------------------------------
Localization Localization
Many of the tests below looking-up timezones by Name do not support localization. Many of the tests below looking-up timezones by Name do not support localization.
That is, the current tests use us english versions of StandardName and DaylighName for tests. That is, the current tests use us english versions of StandardName and DaylightName for tests.
ref: https://msdn.microsoft.com/en-us/library/windows/desktop/ms725481.aspx ref: https://msdn.microsoft.com/en-us/library/windows/desktop/ms725481.aspx
[snippet] Both StandardName and DaylightName are localized according to the current user default UI language. [snippet] Both StandardName and DaylightName are localized according to the current user default UI language.

View file

@ -126,7 +126,7 @@ Describe "Test suite for NewFileCatalogAndTestFileCatalogCmdlets" -Tags "CI" {
CompareHashTables $result.CatalogItems $expectedPathsAndHashes CompareHashTables $result.CatalogItems $expectedPathsAndHashes
} }
It "NewFileCatalogWithMutipleFoldersAndFiles" -Skip:$true { It "NewFileCatalogWithMultipleFoldersAndFiles" -Skip:$true {
$expectedPathsAndHashes = @{ $expectedPathsAndHashes = @{
"UserConfigProv.psd1" = "748E5486814051DA3DFB79FE8964152727213248" ; "UserConfigProv.psd1" = "748E5486814051DA3DFB79FE8964152727213248" ;
@ -141,7 +141,7 @@ Describe "Test suite for NewFileCatalogAndTestFileCatalogCmdlets" -Tags "CI" {
"CatalogTestFile1.mof" = "083B0953D0D70FFF62710F0356FEB86BCE327FE7"; "CatalogTestFile1.mof" = "083B0953D0D70FFF62710F0356FEB86BCE327FE7";
"CatalogTestFile2.xml" = "E73BB7A0DD9FAC6A8182F67B750D9CA3094490F1" } "CatalogTestFile2.xml" = "E73BB7A0DD9FAC6A8182F67B750D9CA3094490F1" }
$catalogPath = "$env:TEMP\NewFileCatalogWithMutipleFoldersAndFiles.cat" $catalogPath = "$env:TEMP\NewFileCatalogWithMultipleFoldersAndFiles.cat"
$catalogDataPath = @("$testDataPath\UserConfigProv\","$testDataPath\CatalogTestFile1.mof","$testDataPath\CatalogTestFile2.xml") $catalogDataPath = @("$testDataPath\UserConfigProv\","$testDataPath\CatalogTestFile1.mof","$testDataPath\CatalogTestFile2.xml")
try try
@ -164,7 +164,7 @@ Describe "Test suite for NewFileCatalogAndTestFileCatalogCmdlets" -Tags "CI" {
CompareHashTables $result.CatalogItems $expectedPathsAndHashes CompareHashTables $result.CatalogItems $expectedPathsAndHashes
} }
It "NewFileCatalogVersion2WithMutipleFoldersAndFiles" -Skip:$true { It "NewFileCatalogVersion2WithMultipleFoldersAndFiles" -Skip:$true {
$expectedPathsAndHashes = @{ $expectedPathsAndHashes = @{
"UserConfigProv.psd1" = "9FFE4CA2873CD91CDC9D71362526446ECACDA64D26DEA768E6CE489B84D888E4" ; "UserConfigProv.psd1" = "9FFE4CA2873CD91CDC9D71362526446ECACDA64D26DEA768E6CE489B84D888E4" ;
@ -181,7 +181,7 @@ Describe "Test suite for NewFileCatalogAndTestFileCatalogCmdlets" -Tags "CI" {
"TestImage.gif" = "2D938D255D0D6D547747BD21447CF7295318D34D9B4105D04C1C27487D2FF402" } "TestImage.gif" = "2D938D255D0D6D547747BD21447CF7295318D34D9B4105D04C1C27487D2FF402" }
$catalogPath = "$env:TEMP\NewFileCatalogVersion2WithMutipleFoldersAndFiles.cat" $catalogPath = "$env:TEMP\NewFileCatalogVersion2WithMultipleFoldersAndFiles.cat"
$catalogDataPath = @("$testDataPath\UserConfigProv\","$testDataPath\CatalogTestFile1.mof","$testDataPath\CatalogTestFile2.xml", "$testDataPath\TestImage.gif") $catalogDataPath = @("$testDataPath\UserConfigProv\","$testDataPath\CatalogTestFile1.mof","$testDataPath\CatalogTestFile2.xml", "$testDataPath\TestImage.gif")
try try
@ -203,9 +203,9 @@ Describe "Test suite for NewFileCatalogAndTestFileCatalogCmdlets" -Tags "CI" {
CompareHashTables $result.CatalogItems $expectedPathsAndHashes CompareHashTables $result.CatalogItems $expectedPathsAndHashes
} }
It "NewFileCatalogFolderWhenCatlogFileIsCreatedInsideSameFolder" { It "NewFileCatalogFolderWhenCatalogFileIsCreatedInsideSameFolder" {
$catalogPath = "$env:TEMP\UserConfigProv\NewFileCatalogFolderWhenCatlogFileIsCreatedInsideSameFolder.cat" $catalogPath = "$env:TEMP\UserConfigProv\NewFileCatalogFolderWhenCatalogFileIsCreatedInsideSameFolder.cat"
try try
{ {
copy-item "$testDataPath\UserConfigProv" $env:temp -Recurse -ErrorAction SilentlyContinue copy-item "$testDataPath\UserConfigProv" $env:temp -Recurse -ErrorAction SilentlyContinue
@ -368,9 +368,9 @@ Describe "Test suite for NewFileCatalogAndTestFileCatalogCmdlets" -Tags "CI" {
$result | Should Be "Valid" $result | Should Be "Valid"
} }
It "TestCatalogSkipMuitplePattensDuringValidation" { It "TestCatalogSkipMultiplePattensDuringValidation" {
$script:catalogPath = "$env:TEMP\TestCatalogSkipMuitplePattensDuringValidation.cat" $script:catalogPath = "$env:TEMP\TestCatalogSkipMultiplePattensDuringValidation.cat"
$null = New-FileCatalog -Path $testDataPath\UserConfigProv\ -CatalogFilePath $script:catalogPath -CatalogVersion 1.0 $null = New-FileCatalog -Path $testDataPath\UserConfigProv\ -CatalogFilePath $script:catalogPath -CatalogVersion 1.0
$result = Test-FileCatalog -Path $testDataPath\UserConfigProv\ -CatalogFilePath $script:catalogPath -FilesToSkip "*.psd1","UserConfigProviderModVersion2.psm1","*ModVersion1.schema.mof" $result = Test-FileCatalog -Path $testDataPath\UserConfigProv\ -CatalogFilePath $script:catalogPath -FilesToSkip "*.psd1","UserConfigProviderModVersion2.psm1","*ModVersion1.schema.mof"
$result | Should Be "Valid" $result | Should Be "Valid"

View file

@ -2,7 +2,7 @@
# The Get-TargetResource cmdlet is used to fetch the desired state of the DSC managed node through a powershell script. # The Get-TargetResource cmdlet is used to fetch the desired state of the DSC managed node through a powershell script.
# This cmdlet executes the user supplied script (i.e., the script is responsible for validating the desired state of the # This cmdlet executes the user supplied script (i.e., the script is responsible for validating the desired state of the
# DSC managed node). The result of the script execution is in the form of a hashtable containing all the inormation # DSC managed node). The result of the script execution is in the form of a hashtable containing all the information
# gathered from the GetScript execution. # gathered from the GetScript execution.
function Get-TargetResource function Get-TargetResource
{ {
@ -25,7 +25,7 @@ function Get-TargetResource
# The Set-TargetResource cmdlet is used to Set the desired state of the DSC managed node through a powershell script. # The Set-TargetResource cmdlet is used to Set the desired state of the DSC managed node through a powershell script.
# The method executes the user supplied script (i.e., the script is responsible for validating the desired state of the # The method executes the user supplied script (i.e., the script is responsible for validating the desired state of the
# DSC managed node). If the DSC managed node requires a restart either during or after the execution of the SetScript, # DSC managed node). If the DSC managed node requires a restart either during or after the execution of the SetScript,
# the SetScript notifies the PS Infrasturcure by setting the variable $DSCMachineStatus.IsRestartRequired to $true. # the SetScript notifies the PS Infrastructure by setting the variable $DSCMachineStatus.IsRestartRequired to $true.
function Set-TargetResource function Set-TargetResource
{ {
[CmdletBinding()] [CmdletBinding()]

View file

@ -2,7 +2,7 @@
# The Get-TargetResource cmdlet is used to fetch the desired state of the DSC managed node through a powershell script. # The Get-TargetResource cmdlet is used to fetch the desired state of the DSC managed node through a powershell script.
# This cmdlet executes the user supplied script (i.e., the script is responsible for validating the desired state of the # This cmdlet executes the user supplied script (i.e., the script is responsible for validating the desired state of the
# DSC managed node). The result of the script execution is in the form of a hashtable containing all the inormation # DSC managed node). The result of the script execution is in the form of a hashtable containing all the information
# gathered from the GetScript execution. # gathered from the GetScript execution.
function Get-TargetResource function Get-TargetResource
{ {
@ -25,7 +25,7 @@ function Get-TargetResource
# The Set-TargetResource cmdlet is used to Set the desired state of the DSC managed node through a powershell script. # The Set-TargetResource cmdlet is used to Set the desired state of the DSC managed node through a powershell script.
# The method executes the user supplied script (i.e., the script is responsible for validating the desired state of the # The method executes the user supplied script (i.e., the script is responsible for validating the desired state of the
# DSC managed node). If the DSC managed node requires a restart either during or after the execution of the SetScript, # DSC managed node). If the DSC managed node requires a restart either during or after the execution of the SetScript,
# the SetScript notifies the PS Infrasturcure by setting the variable $DSCMachineStatus.IsRestartRequired to $true. # the SetScript notifies the PS Infrastructure by setting the variable $DSCMachineStatus.IsRestartRequired to $true.
function Set-TargetResource function Set-TargetResource
{ {
[CmdletBinding()] [CmdletBinding()]

View file

@ -2,7 +2,7 @@
# The Get-TargetResource cmdlet is used to fetch the desired state of the DSC managed node through a powershell script. # The Get-TargetResource cmdlet is used to fetch the desired state of the DSC managed node through a powershell script.
# This cmdlet executes the user supplied script (i.e., the script is responsible for validating the desired state of the # This cmdlet executes the user supplied script (i.e., the script is responsible for validating the desired state of the
# DSC managed node). The result of the script execution is in the form of a hashtable containing all the inormation # DSC managed node). The result of the script execution is in the form of a hashtable containing all the information
# gathered from the GetScript execution. # gathered from the GetScript execution.
function Get-TargetResource function Get-TargetResource
{ {
@ -25,7 +25,7 @@ function Get-TargetResource
# The Set-TargetResource cmdlet is used to Set the desired state of the DSC managed node through a powershell script. # The Set-TargetResource cmdlet is used to Set the desired state of the DSC managed node through a powershell script.
# The method executes the user supplied script (i.e., the script is responsible for validating the desired state of the # The method executes the user supplied script (i.e., the script is responsible for validating the desired state of the
# DSC managed node). If the DSC managed node requires a restart either during or after the execution of the SetScript, # DSC managed node). If the DSC managed node requires a restart either during or after the execution of the SetScript,
# the SetScript notifies the PS Infrasturcure by setting the variable $DSCMachineStatus.IsRestartRequired to $true. # the SetScript notifies the PS Infrastructure by setting the variable $DSCMachineStatus.IsRestartRequired to $true.
function Set-TargetResource function Set-TargetResource
{ {
[CmdletBinding()] [CmdletBinding()]

View file

@ -9,7 +9,7 @@ Describe 'ConvertFrom-Json' -tags "CI" {
$json[1].a | Should Be 'x' $json[1].a | Should Be 'x'
} }
It 'can convert mutli-line object' { It 'can convert multi-line object' {
$json = @('{"a" :', '"x"}') | ConvertFrom-Json $json = @('{"a" :', '"x"}') | ConvertFrom-Json
$json.a | Should Be 'x' $json.a | Should Be 'x'
} }

View file

@ -107,7 +107,7 @@ Describe "Format-List DRT basic functionality" -Tags "CI" {
} }
It "Format-List with complex object for End-To-End should work" { It "Format-List with complex object for End-To-End should work" {
Add-Type -TypeDefinition "public enum MyDayOfWeek{Sun,Mon,Tue,Wed,Thr,Fri,Sat}" Add-Type -TypeDefinition "public enum MyDayOfWeek{Sun,Mon,Tue,Wed,Thu,Fri,Sat}"
$eto = [MyDayOfWeek]::New() $eto = [MyDayOfWeek]::New()
$info = @{} $info = @{}
$info.intArray = 1,2,3,4 $info.intArray = 1,2,3,4

View file

@ -177,7 +177,7 @@ Describe "Format-Table DRT Unit Tests" -Tags "CI" {
} }
It "Format-Table with complex object for End-To-End should work" { It "Format-Table with complex object for End-To-End should work" {
Add-Type -TypeDefinition "public enum MyDayOfWeek{Sun,Mon,Tue,Wed,Thr,Fri,Sat}" Add-Type -TypeDefinition "public enum MyDayOfWeek{Sun,Mon,Tue,Wed,Thu,Fri,Sat}"
$eto = New-Object MyDayOfWeek $eto = New-Object MyDayOfWeek
$info = @{} $info = @{}
$info.intArray = 1,2,3,4 $info.intArray = 1,2,3,4

View file

@ -81,7 +81,7 @@ Describe "Format-Wide DRT basic functionality" -Tags "CI" {
} }
It "Format-Wide with complex object for End-To-End should work" { It "Format-Wide with complex object for End-To-End should work" {
Add-Type -TypeDefinition "public enum MyDayOfWeek{Sun,Mon,Tue,Wed,Thr,Fri,Sat}" Add-Type -TypeDefinition "public enum MyDayOfWeek{Sun,Mon,Tue,Wed,Thu,Fri,Sat}"
$eto = New-Object MyDayOfWeek $eto = New-Object MyDayOfWeek
$info = @{} $info = @{}
$info.intArray = 1,2,3,4 $info.intArray = 1,2,3,4

View file

@ -5,7 +5,7 @@
<# <#
Purpose: Purpose:
Verify that Format-Hex display the Hexa decmial value for the input data. Verify that Format-Hex display the Hexa decimal value for the input data.
Action: Action:
Run Format-Fex. Run Format-Fex.
@ -49,7 +49,7 @@ Describe "FormatHex" -tags "CI" {
($actualResult -match $inputText1) | Should Be $true ($actualResult -match $inputText1) | Should Be $true
} }
# This test is to validate to input given through Path paramter set in Format-Hex cmdlet. # This test is to validate to input given through Path parameter set in Format-Hex cmdlet.
It "ValidatePathParameterSet" { It "ValidatePathParameterSet" {
$result = Format-Hex -Path $inputFile1 $result = Format-Hex -Path $inputFile1
@ -59,7 +59,7 @@ Describe "FormatHex" -tags "CI" {
($actualResult -match $inputText1) | Should Be $true ($actualResult -match $inputText1) | Should Be $true
} }
# This test is to validate to Path paramter set is considered as default in Format-Hex cmdlet. # This test is to validate to Path parameter set is considered as default in Format-Hex cmdlet.
It "ValidatePathAsDefaultParameterSet" { It "ValidatePathAsDefaultParameterSet" {
$result = Format-Hex $inputFile1 $result = Format-Hex $inputFile1
@ -69,7 +69,7 @@ Describe "FormatHex" -tags "CI" {
($actualResult -match $inputText1) | Should Be $true ($actualResult -match $inputText1) | Should Be $true
} }
# This test is to validate to input given through LiteralPath paramter set in Format-Hex cmdlet. # This test is to validate to input given through LiteralPath parameter set in Format-Hex cmdlet.
It "ValidateLiteralPathParameterSet" { It "ValidateLiteralPathParameterSet" {
$result = Format-Hex -LiteralPath $inputFile1 $result = Format-Hex -LiteralPath $inputFile1

View file

@ -15,7 +15,7 @@ Describe "Get-Random DRT Unit Tests" -Tags "CI" {
@{ Name = 'maximum is Int64.MaxValue'; Maximum = ([int64]::MaxValue); Minimum = $null; GreaterThan = ([int64]-1); LessThan = ([int64]::MaxValue); Type = 'System.Int64' } @{ Name = 'maximum is Int64.MaxValue'; Maximum = ([int64]::MaxValue); Minimum = $null; GreaterThan = ([int64]-1); LessThan = ([int64]::MaxValue); Type = 'System.Int64' }
@{ Name = 'maximum is a 64-bit integer'; Maximum = ([int64]100); Minimum = $null; GreaterThan = ([int64]-1); LessThan = ([int64]100); Type = 'System.Int64' } @{ Name = 'maximum is a 64-bit integer'; Maximum = ([int64]100); Minimum = $null; GreaterThan = ([int64]-1); LessThan = ([int64]100); Type = 'System.Int64' }
@{ Name = 'maximum set to a large integer greater than int32.MaxValue'; Maximum = 100000000000; Minimum = $null; GreaterThan = ([int64]-1); LessThan = ([int64]100000000000); Type = 'System.Int64' } @{ Name = 'maximum set to a large integer greater than int32.MaxValue'; Maximum = 100000000000; Minimum = $null; GreaterThan = ([int64]-1); LessThan = ([int64]100000000000); Type = 'System.Int64' }
@{ Name = 'maximum set to 0, Minumum set to a negative 64-bit integer'; Maximum = ([int64]0); Minimum = ([int64]-100); GreaterThan = ([int64]-101); LessThan = ([int64]0); Type = 'System.Int64' } @{ Name = 'maximum set to 0, Minimum set to a negative 64-bit integer'; Maximum = ([int64]0); Minimum = ([int64]-100); GreaterThan = ([int64]-101); LessThan = ([int64]0); Type = 'System.Int64' }
@{ Name = 'maximum set to positive 64-bit number, min set to negative 64-bit number'; Maximum = ([int64]100); Minimum = ([int64]-100); GreaterThan = ([int64]-101); LessThan = ([int64]100); Type = 'System.Int64' } @{ Name = 'maximum set to positive 64-bit number, min set to negative 64-bit number'; Maximum = ([int64]100); Minimum = ([int64]-100); GreaterThan = ([int64]-101); LessThan = ([int64]100); Type = 'System.Int64' }
@{ Name = 'both are negative 64-bit number'; Maximum = ([int64]-100); Minimum = ([int64]-200); GreaterThan = ([int64]-201); LessThan = ([int64]-100); Type = 'System.Int64' } @{ Name = 'both are negative 64-bit number'; Maximum = ([int64]-100); Minimum = ([int64]-200); GreaterThan = ([int64]-201); LessThan = ([int64]-100); Type = 'System.Int64' }
@{ Name = 'both are negative 64-bit number with parentheses'; Maximum = ([int64](-100)); Minimum = ([int64](-200)); GreaterThan = ([int64]-201); LessThan = ([int64]-100); Type = 'System.Int64' } @{ Name = 'both are negative 64-bit number with parentheses'; Maximum = ([int64](-100)); Minimum = ([int64](-200)); GreaterThan = ([int64]-201); LessThan = ([int64]-100); Type = 'System.Int64' }
@ -39,7 +39,7 @@ Describe "Get-Random DRT Unit Tests" -Tags "CI" {
@{ Name = 'max set to a special double number'; Maximum = 20.; Minimum = 0.0; GreaterThan = -1.0; LessThan = 20.0; Type = 'System.Double' } @{ Name = 'max set to a special double number'; Maximum = 20.; Minimum = 0.0; GreaterThan = -1.0; LessThan = 20.0; Type = 'System.Double' }
@{ Name = 'max is double with quote'; Maximum = '20.'; Minimum = 0.0; GreaterThan = -1.0; LessThan = 20.0; Type = 'System.Double' } @{ Name = 'max is double with quote'; Maximum = '20.'; Minimum = 0.0; GreaterThan = -1.0; LessThan = 20.0; Type = 'System.Double' }
@{ Name = 'max is double with plus sign'; Maximum = +100.0; Minimum = 0; GreaterThan = -1.0; LessThan = 100.0; Type = 'System.Double' } @{ Name = 'max is double with plus sign'; Maximum = +100.0; Minimum = 0; GreaterThan = -1.0; LessThan = 100.0; Type = 'System.Double' }
@{ Name = 'max is doulbe with plus sign and enclosed in quote'; Maximum = '+100.0'; Minimum = 0; GreaterThan = -1.0; LessThan = 100.0; Type = 'System.Double' } @{ Name = 'max is double with plus sign and enclosed in quote'; Maximum = '+100.0'; Minimum = 0; GreaterThan = -1.0; LessThan = 100.0; Type = 'System.Double' }
@{ Name = 'both set to the special numbers as 1.0e+xx '; Maximum = $null; Minimum = 1.0e+100; GreaterThan = 1.0e+99; LessThan = ([double]::MaxValue); Type = 'System.Double' } @{ Name = 'both set to the special numbers as 1.0e+xx '; Maximum = $null; Minimum = 1.0e+100; GreaterThan = 1.0e+99; LessThan = ([double]::MaxValue); Type = 'System.Double' }
@{ Name = 'max is Double.MaxValue, min is Double.MinValue'; Maximum = ([double]::MaxValue); Minimum = ([double]::MinValue); GreaterThan = ([double]::MinValue); LessThan = ([double]::MaxValue); Type = 'System.Double' } @{ Name = 'max is Double.MaxValue, min is Double.MinValue'; Maximum = ([double]::MaxValue); Minimum = ([double]::MinValue); GreaterThan = ([double]::MinValue); LessThan = ([double]::MaxValue); Type = 'System.Double' }
@ -150,7 +150,7 @@ Describe "Get-Random" -Tags "CI" {
$randomNumber | Should Be ("red" -or "yellow" -or "blue") $randomNumber | Should Be ("red" -or "yellow" -or "blue")
} }
It "Should return a number for hexdecimal " { It "Should return a number for hexadecimal " {
$randomNumber = Get-Random 0x07FFFFFFFFF $randomNumber = Get-Random 0x07FFFFFFFFF
$randomNumber | Should BeLessThan 549755813887 $randomNumber | Should BeLessThan 549755813887
$randomNumber | Should BeGreaterThan 0 $randomNumber | Should BeGreaterThan 0
@ -162,12 +162,12 @@ Describe "Get-Random" -Tags "CI" {
$firstRandomNumber | Should Not Be $secondRandomNumber $firstRandomNumber | Should Not Be $secondRandomNumber
} }
It "Should return the same number for hexidemical number and regular number when the switch SetSeed it used " { It "Should return the same number for hexadecimal number and regular number when the switch SetSeed it used " {
$firstRandomNumber = Get-Random 0x07FFFFFFFF -SetSeed 20 $firstRandomNumber = Get-Random 0x07FFFFFFFF -SetSeed 20
$secondRandomNumber = Get-Random 34359738367 -SetSeed 20 $secondRandomNumber = Get-Random 34359738367 -SetSeed 20
$firstRandomNumber | Should Be @secondRandomNumber $firstRandomNumber | Should Be @secondRandomNumber
} }
It "Should throw an error because the hexidecial number is to large " { It "Should throw an error because the hexadecimal number is to large " {
{ Get-Random 0x07FFFFFFFFFFFFFFFF } | Should Throw "Value was either too large or too small for a UInt32" { Get-Random 0x07FFFFFFFFFFFFFFFF } | Should Throw "Value was either too large or too small for a UInt32"
} }
} }

View file

@ -112,7 +112,7 @@ Describe "New-Object DRT basic functionality" -Tags "CI" {
} }
} }
It "New-Object with bad argument for class construtor should throw Exception"{ It "New-Object with bad argument for class constructor should throw Exception"{
if(-not ([System.Management.Automation.PSTypeName]'Employee').Type) if(-not ([System.Management.Automation.PSTypeName]'Employee').Type)
{ {
Add-Type -TypeDefinition "public class Employee{public Employee(string firstName,string lastName,int yearsInMS){FirstName = firstName;LastName=lastName;YearsInMS = yearsInMS;}public string FirstName;public string LastName;public int YearsInMS;}" Add-Type -TypeDefinition "public class Employee{public Employee(string firstName,string lastName,int yearsInMS){FirstName = firstName;LastName=lastName;YearsInMS = yearsInMS;}public string FirstName;public string LastName;public int YearsInMS;}"
@ -130,7 +130,7 @@ Describe "New-Object DRT basic functionality" -Tags "CI" {
} }
#This case will throw "Execution OK" now, just mark as pending now #This case will throw "Execution OK" now, just mark as pending now
It "New-Object with not init class construtor should throw Exception" -Pending{ It "New-Object with not init class constructor should throw Exception" -Pending{
if(-not ([System.Management.Automation.PSTypeName]'Employee').Type) if(-not ([System.Management.Automation.PSTypeName]'Employee').Type)
{ {
Add-Type -TypeDefinition "public class Employee{public Employee(string firstName,string lastName,int yearsInMS){FirstName = firstName;LastName=lastName;YearsInMS = yearsInMS;}public string FirstName;public string LastName;public int YearsInMS;}" Add-Type -TypeDefinition "public class Employee{public Employee(string firstName,string lastName,int yearsInMS){FirstName = firstName;LastName=lastName;YearsInMS = yearsInMS;}public string FirstName;public string LastName;public int YearsInMS;}"

View file

@ -1,5 +1,5 @@
Describe "Out-File DRT Unit Tests" -Tags "CI" { Describe "Out-File DRT Unit Tests" -Tags "CI" {
It "Should be able to write the contens into a file with -pspath" { It "Should be able to write the contents into a file with -pspath" {
$tempFile = Join-Path -Path $TestDrive -ChildPath "ExposeBug928965" $tempFile = Join-Path -Path $TestDrive -ChildPath "ExposeBug928965"
{ 1 | Out-File -PSPath $tempFile } | Should Not Throw { 1 | Out-File -PSPath $tempFile } | Should Not Throw
$fileContents = Get-Content $tempFile $fileContents = Get-Content $tempFile
@ -7,7 +7,7 @@ Describe "Out-File DRT Unit Tests" -Tags "CI" {
Remove-Item $tempFile -Force Remove-Item $tempFile -Force
} }
It "Should be able to write the contens into a file with -pspath" { It "Should be able to write the contents into a file with -pspath" {
$tempFile = Join-Path -Path $TestDrive -ChildPath "outfileAppendTest.txt" $tempFile = Join-Path -Path $TestDrive -ChildPath "outfileAppendTest.txt"
{ 'This is first line.' | out-file $tempFile } | Should Not Throw { 'This is first line.' | out-file $tempFile } | Should Not Throw
{ 'This is second line.' | out-file -append $tempFile } | Should Not Throw { 'This is second line.' | out-file -append $tempFile } | Should Not Throw
@ -38,7 +38,7 @@ Describe "Out-File" -Tags "CI" {
$actual | Should Be $expectedContent $actual | Should Be $expectedContent
} }
It "Should be able to accept string input via the InputObject swictch" { It "Should be able to accept string input via the InputObject switch" {
{ Out-File -FilePath $testfile -InputObject $expectedContent } | Should Not Throw { Out-File -FilePath $testfile -InputObject $expectedContent } | Should Not Throw
$actual = Get-Content $testfile $actual = Get-Content $testfile

View file

@ -223,7 +223,7 @@ Describe "Json Tests" -Tags "Feature" {
# add a NoteProperty member called Note with a text note # add a NoteProperty member called Note with a text note
$versionObject | Add-Member -MemberType NoteProperty -Name Note -Value "a version object" $versionObject | Add-Member -MemberType NoteProperty -Name Note -Value "a version object"
# add an AliasProperty called Rev as an alias to the Revison property # add an AliasProperty called Rev as an alias to the Revision property
$versionObject | Add-Member -MemberType AliasProperty -Name Rev -Value Revision $versionObject | Add-Member -MemberType AliasProperty -Name Rev -Value Revision
# add a ScriptProperty called IsOld which returns whether the version is an older version # add a ScriptProperty called IsOld which returns whether the version is an older version
@ -1407,7 +1407,7 @@ Describe "Json Bug fixes" -Tags "Feature" {
$testCases = @( $testCases = @(
@{ @{
Name = "ConvertTo-Json -Depth 101 throws MaximumAllowedDepthReached when the user specifies a depth greather than 100." Name = "ConvertTo-Json -Depth 101 throws MaximumAllowedDepthReached when the user specifies a depth greater than 100."
NumberOfElements = 10 NumberOfElements = 10
MaxDepth = 101 MaxDepth = 101
FullyQualifiedErrorId = "ReachedMaximumDepthAllowed,Microsoft.PowerShell.Commands.ConvertToJsonCommand" FullyQualifiedErrorId = "ReachedMaximumDepthAllowed,Microsoft.PowerShell.Commands.ConvertToJsonCommand"

View file

@ -25,7 +25,7 @@ Describe "Remove-Variable" -Tags "CI" {
} }
It "Should throw error when used with Name field, and named variable does not exist" { It "Should throw error when used with Name field, and named variable does not exist" {
Remove-Variable -Name nonexistantVariable -ErrorAction SilentlyContinue | Should Throw Remove-Variable -Name nonexistentVariable -ErrorAction SilentlyContinue | Should Throw
} }
It "Should be able to remove a variable using the rv alias" { It "Should be able to remove a variable using the rv alias" {

View file

@ -37,7 +37,7 @@ Describe "Select-String" -Tags "CI" {
{$testinputone | Select-String -Pattern "hello" -ca } | Should Not Throw {$testinputone | Select-String -Pattern "hello" -ca } | Should Not Throw
} }
it "Should use the ca alias for casesenstive" { it "Should use the ca alias for casesensitive" {
$firstMatch = $testinputtwo | Select-String -Pattern "hello" -CaseSensitive $firstMatch = $testinputtwo | Select-String -Pattern "hello" -CaseSensitive
$secondMatch = $testinputtwo | Select-String -Pattern "hello" -ca $secondMatch = $testinputtwo | Select-String -Pattern "hello" -ca
@ -86,7 +86,7 @@ Describe "Select-String" -Tags "CI" {
} }
} }
Context "Filesytem actions" { Context "Filesystem actions" {
$testDirectory = $TestDrive $testDirectory = $TestDrive
$testInputFile = Join-Path -Path $testDirectory -ChildPath testfile1.txt $testInputFile = Join-Path -Path $testDirectory -ChildPath testfile1.txt

View file

@ -3,16 +3,16 @@ Describe "Start-Sleep DRT Unit Tests" -Tags "CI" {
$dtStart = [DateTime]::Now $dtStart = [DateTime]::Now
Start-Sleep -Seconds 1 Start-Sleep -Seconds 1
$dtEnd = [DateTime]::Now $dtEnd = [DateTime]::Now
$millseconds = (New-TimeSpan -Start $dtStart -End $dtEnd).TotalMilliseconds $milliseconds = (New-TimeSpan -Start $dtStart -End $dtEnd).TotalMilliseconds
$millseconds | Should BeGreaterThan 1000 $milliseconds | Should BeGreaterThan 1000
} }
It "Should be works properly when sleeping with Milliseconds" { It "Should be works properly when sleeping with Milliseconds" {
$dtStart = [DateTime]::Now $dtStart = [DateTime]::Now
Start-Sleep -Milliseconds 1000 Start-Sleep -Milliseconds 1000
$dtEnd = [DateTime]::Now $dtEnd = [DateTime]::Now
$millseconds = (New-TimeSpan -Start $dtStart -End $dtEnd).TotalMilliseconds $milliseconds = (New-TimeSpan -Start $dtStart -End $dtEnd).TotalMilliseconds
$millseconds | Should BeGreaterThan 1000 $milliseconds | Should BeGreaterThan 1000
} }
} }

View file

@ -1,7 +1,7 @@
# This came from monad/tests/ci/PowerShell/tests/Commands/Cmdlets/pester.utility.command.tests.ps1 # This came from monad/tests/ci/PowerShell/tests/Commands/Cmdlets/pester.utility.command.tests.ps1
Describe "Trace-Command" -tags "CI" { Describe "Trace-Command" -tags "CI" {
Context "Listner options" { Context "Listener options" {
BeforeAll { BeforeAll {
$logFile = New-Item "TestDrive:/traceCommandLog.txt" -Force $logFile = New-Item "TestDrive:/traceCommandLog.txt" -Force
$actualLogFile = New-Item "TestDrive:/actualTraceCommandLog.txt" -Force $actualLogFile = New-Item "TestDrive:/actualTraceCommandLog.txt" -Force

View file

@ -153,7 +153,7 @@ Describe "Invoke-WebRequest tests" -Tags "Feature" {
$response.Error | Should Be $null $response.Error | Should Be $null
# A sucessful call returns: Status = 200, and StatusDescription = "OK" # A successful call returns: Status = 200, and StatusDescription = "OK"
$response.Output.StatusDescription | Should Match "OK" $response.Output.StatusDescription | Should Match "OK"
$response.Output.StatusCode | Should Be 200 $response.Output.StatusCode | Should Be 200

View file

@ -1,3 +1,3 @@
Name,Planet,Heads,Arms,Brains,Assessment Name,Planet,Heads,Arms,Brains,Assessment
Zaphod BeebleBrox,Beetlgeuse,2,3,Indeterminant,Dangerous Zaphod BeebleBrox,Beetlgeuse,2,3,Indeterminate,Dangerous
Arthur Dent,Earth,1,2,Some,Harmless (Mostly) Arthur Dent,Earth,1,2,Some,Harmless (Mostly)

1 Name Planet Heads Arms Brains Assessment
2 Zaphod BeebleBrox Beetlgeuse 2 3 Indeterminant Indeterminate Dangerous
3 Arthur Dent Earth 1 2 Some Harmless (Mostly)

View file

@ -1,6 +1,6 @@
Describe "Trace-Command" -tags "Feature" { Describe "Trace-Command" -tags "Feature" {
Context "Listner options" { Context "Listener options" {
BeforeAll { BeforeAll {
$logFile = setup -f traceCommandLog.txt -pass $logFile = setup -f traceCommandLog.txt -pass
$actualLogFile = setup -f actualTraceCommandLog.txt -pass $actualLogFile = setup -f actualTraceCommandLog.txt -pass

View file

@ -24,9 +24,9 @@
Describe "Object cmdlets" -Tags "CI" { Describe "Object cmdlets" -Tags "CI" {
Context "Measure-Object" { Context "Measure-Object" {
BeforeAll { BeforeAll {
## Powershell language prefers , as an array seperator without "". ## Powershell language prefers , as an array separator without "".
## If a number has comma in them it considers it to be the 1000 seperator like "1,000". ## If a number has comma in them it considers it to be the 1000 separator like "1,000".
## In de-DE language the comma is used as decimal point, but powershell still uses it as a 1000 seperator. ## In de-DE language the comma is used as decimal point, but powershell still uses it as a 1000 separator.
## In case the number has a comma, it is ignored. So, "99,1" becomes 991. ## In case the number has a comma, it is ignored. So, "99,1" becomes 991.
## To work around that behavior, we use ToString() on the expected answer and . for decimal in the input. ## To work around that behavior, we use ToString() on the expected answer and . for decimal in the input.

View file

@ -194,7 +194,7 @@ Describe "find-packageprovider Error Cases" -Tags "Feature" {
} }
} }
It "EXPECTED: returns an error when inputing a bad version format" { It "EXPECTED: returns an error when inputting a bad version format" {
$Error.Clear() $Error.Clear()
find-packageprovider -name Gistprovider -RequiredVersion BOGUSVERSION -warningaction:silentlycontinue -ea silentlycontinue find-packageprovider -name Gistprovider -RequiredVersion BOGUSVERSION -warningaction:silentlycontinue -ea silentlycontinue
$ERROR[0].FullyQualifiedErrorId | should be "InvalidVersion,Microsoft.PowerShell.PackageManagement.Cmdlets.FindPackageProvider" $ERROR[0].FullyQualifiedErrorId | should be "InvalidVersion,Microsoft.PowerShell.PackageManagement.Cmdlets.FindPackageProvider"
@ -208,13 +208,13 @@ Describe "find-packageprovider Error Cases" -Tags "Feature" {
} }
It "EXPECTED: returns an error when asking for a provider with RequiredVersoin and MinimumVersion" { It "EXPECTED: returns an error when asking for a provider with RequiredVersion and MinimumVersion" {
$Error.Clear() $Error.Clear()
find-packageprovider -name NOT_EXISTS -RequiredVersion 1.0 -MinimumVersion 2.0 -warningaction:silentlycontinue -ea silentlycontinue find-packageprovider -name NOT_EXISTS -RequiredVersion 1.0 -MinimumVersion 2.0 -warningaction:silentlycontinue -ea silentlycontinue
$ERROR[0].FullyQualifiedErrorId | should be "VersionRangeAndRequiredVersionCannotBeSpecifiedTogether,Microsoft.PowerShell.PackageManagement.Cmdlets.FindPackageProvider" $ERROR[0].FullyQualifiedErrorId | should be "VersionRangeAndRequiredVersionCannotBeSpecifiedTogether,Microsoft.PowerShell.PackageManagement.Cmdlets.FindPackageProvider"
} }
It "EXPECTED: returns an error when asking for a provider with RequiredVersoin and MaximumVersion" { It "EXPECTED: returns an error when asking for a provider with RequiredVersion and MaximumVersion" {
$Error.Clear() $Error.Clear()
find-packageprovider -name NOT_EXISTS -RequiredVersion 1.0 -MaximumVersion 2.0 -warningaction:silentlycontinue -ea silentlycontinue find-packageprovider -name NOT_EXISTS -RequiredVersion 1.0 -MaximumVersion 2.0 -warningaction:silentlycontinue -ea silentlycontinue
$ERROR[0].FullyQualifiedErrorId | should be "VersionRangeAndRequiredVersionCannotBeSpecifiedTogether,Microsoft.PowerShell.PackageManagement.Cmdlets.FindPackageProvider" $ERROR[0].FullyQualifiedErrorId | should be "VersionRangeAndRequiredVersionCannotBeSpecifiedTogether,Microsoft.PowerShell.PackageManagement.Cmdlets.FindPackageProvider"

View file

@ -167,7 +167,7 @@ Describe "import-packageprovider Error Cases" -Tags "Feature" {
$ERROR[0].FullyQualifiedErrorId | should be "InvalidParameter,Microsoft.PowerShell.PackageManagement.Cmdlets.ImportPackageProvider" $ERROR[0].FullyQualifiedErrorId | should be "InvalidParameter,Microsoft.PowerShell.PackageManagement.Cmdlets.ImportPackageProvider"
} }
It "EXPECTED: returns an error when inputing a bad version format" { It "EXPECTED: returns an error when inputting a bad version format" {
$Error.Clear() $Error.Clear()
import-packageprovider -name Gistprovider -RequiredVersion BOGUSVERSION -warningaction:silentlycontinue -ea silentlycontinue import-packageprovider -name Gistprovider -RequiredVersion BOGUSVERSION -warningaction:silentlycontinue -ea silentlycontinue
$ERROR[0].FullyQualifiedErrorId | should be "InvalidVersion,Microsoft.PowerShell.PackageManagement.Cmdlets.ImportPackageProvider" $ERROR[0].FullyQualifiedErrorId | should be "InvalidVersion,Microsoft.PowerShell.PackageManagement.Cmdlets.ImportPackageProvider"
@ -186,13 +186,13 @@ Describe "import-packageprovider Error Cases" -Tags "Feature" {
} }
It "EXPECTED: returns an error when asking for a provider with RequiredVersoin and MinimumVersion" { It "EXPECTED: returns an error when asking for a provider with RequiredVersion and MinimumVersion" {
$Error.Clear() $Error.Clear()
import-packageprovider -name PowerShellGet -RequiredVersion 1.0 -MinimumVersion 2.0 -warningaction:silentlycontinue -ea silentlycontinue import-packageprovider -name PowerShellGet -RequiredVersion 1.0 -MinimumVersion 2.0 -warningaction:silentlycontinue -ea silentlycontinue
$ERROR[0].FullyQualifiedErrorId | should be "VersionRangeAndRequiredVersionCannotBeSpecifiedTogether,Microsoft.PowerShell.PackageManagement.Cmdlets.ImportPackageProvider" $ERROR[0].FullyQualifiedErrorId | should be "VersionRangeAndRequiredVersionCannotBeSpecifiedTogether,Microsoft.PowerShell.PackageManagement.Cmdlets.ImportPackageProvider"
} }
It "EXPECTED: returns an error when asking for a provider with RequiredVersoin and MaximumVersion" { It "EXPECTED: returns an error when asking for a provider with RequiredVersion and MaximumVersion" {
$Error.Clear() $Error.Clear()
import-packageprovider -name PowerShellGet -RequiredVersion 1.0 -MaximumVersion 2.0 -warningaction:silentlycontinue -ea silentlycontinue import-packageprovider -name PowerShellGet -RequiredVersion 1.0 -MaximumVersion 2.0 -warningaction:silentlycontinue -ea silentlycontinue
$ERROR[0].FullyQualifiedErrorId | should be "VersionRangeAndRequiredVersionCannotBeSpecifiedTogether,Microsoft.PowerShell.PackageManagement.Cmdlets.ImportPackageProvider" $ERROR[0].FullyQualifiedErrorId | should be "VersionRangeAndRequiredVersionCannotBeSpecifiedTogether,Microsoft.PowerShell.PackageManagement.Cmdlets.ImportPackageProvider"

View file

@ -128,7 +128,7 @@ Describe "install-packageprovider" -Tags "Feature" {
} }
} }
<# Don't need this test since we are not boostraping <# Don't need this test since we are not bootstraping
Describe "install-packageprovider with local source" -Tags "Feature" { Describe "install-packageprovider with local source" -Tags "Feature" {
BeforeAll{ BeforeAll{
@ -519,8 +519,8 @@ Describe "install-packageprovider with Scope" -Tags "Feature" {
$password = "password%1" $password = "password%1"
#net user $userName /delete | Out-Null #net user $userName /delete | Out-Null
net user $userName $password /add net user $userName $password /add
$secesurestring = ConvertTo-SecureString $password -AsPlainText -Force $securestring = ConvertTo-SecureString $password -AsPlainText -Force
$credential = new-object -typename System.Management.Automation.PSCredential -argumentlist $userName, $secesurestring $credential = new-object -typename System.Management.Automation.PSCredential -argumentlist $userName, $securestring
} }
} }
@ -656,7 +656,7 @@ Describe "install-PackageProvider with Versions" -Tags "Feature" {
} }
Describe "Get-package with mulitiple providers" -Tags "Feature" { Describe "Get-package with multiple providers" -Tags "Feature" {
It "Get-package with multiple providers" -Pending { It "Get-package with multiple providers" -Pending {
@ -733,7 +733,7 @@ Describe "install-packageprovider Error Cases" -Tags "Feature" {
$theError2.FullyQualifiedErrorId| should BeNullOrEmpty $theError2.FullyQualifiedErrorId| should BeNullOrEmpty
} }
It "EXPECTED: returns an error when inputing a bad version format" { It "EXPECTED: returns an error when inputting a bad version format" {
$Error.Clear() $Error.Clear()
install-packageprovider -name nuget -RequiredVersion BOGUSVERSION -warningaction:silentlycontinue -ea silentlycontinue install-packageprovider -name nuget -RequiredVersion BOGUSVERSION -warningaction:silentlycontinue -ea silentlycontinue
$ERROR[0].FullyQualifiedErrorId | should be "InvalidVersion,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackageProvider" $ERROR[0].FullyQualifiedErrorId | should be "InvalidVersion,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackageProvider"
@ -747,13 +747,13 @@ Describe "install-packageprovider Error Cases" -Tags "Feature" {
} }
It "EXPECTED: returns an error when asking for a provider with RequiredVersoin and MinimumVersion" { It "EXPECTED: returns an error when asking for a provider with RequiredVersion and MinimumVersion" {
$Error.Clear() $Error.Clear()
install-packageprovider -name NOT_EXISTS -Scope CurrentUser -RequiredVersion 1.0 -MinimumVersion 2.0 -warningaction:silentlycontinue -ea silentlycontinue install-packageprovider -name NOT_EXISTS -Scope CurrentUser -RequiredVersion 1.0 -MinimumVersion 2.0 -warningaction:silentlycontinue -ea silentlycontinue
$ERROR[0].FullyQualifiedErrorId | should be "VersionRangeAndRequiredVersionCannotBeSpecifiedTogether,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackageProvider" $ERROR[0].FullyQualifiedErrorId | should be "VersionRangeAndRequiredVersionCannotBeSpecifiedTogether,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackageProvider"
} }
It "EXPECTED: returns an error when asking for a provider with RequiredVersoin and MaximumVersion" { It "EXPECTED: returns an error when asking for a provider with RequiredVersion and MaximumVersion" {
$Error.Clear() $Error.Clear()
install-packageprovider -name NOT_EXISTS -Scope CurrentUser -RequiredVersion 1.0 -MaximumVersion 2.0 -warningaction:silentlycontinue -ea silentlycontinue install-packageprovider -name NOT_EXISTS -Scope CurrentUser -RequiredVersion 1.0 -MaximumVersion 2.0 -warningaction:silentlycontinue -ea silentlycontinue
$ERROR[0].FullyQualifiedErrorId | should be "VersionRangeAndRequiredVersionCannotBeSpecifiedTogether,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackageProvider" $ERROR[0].FullyQualifiedErrorId | should be "VersionRangeAndRequiredVersionCannotBeSpecifiedTogether,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackageProvider"

View file

@ -13,8 +13,8 @@ Describe "Help work with ExecutionPolicy Restricted " -Tags "Feature" {
# Validate that 'Get-Help Get-Disk' returns one result when the execution policy is 'Restricted' on Nano # Validate that 'Get-Help Get-Disk' returns one result when the execution policy is 'Restricted' on Nano
# From an internal bug - [Regression] Get-Help returns multiple matches when there is an exact match # From an internal bug - [Regression] Get-Help returns multiple matches when there is an exact match
# Skip the test if Storage module is not available, return a pesudo result # Skip the test if Storage module is not available, return a pseudo result
# ExecutionPoliy only works on windows # ExecutionPolicy only works on windows
It "Test for Get-Help Get-Disk" -skip:(!(Test-Path (Join-Path -Path $PSHOME -ChildPath Modules\Storage\Storage.psd1)) -or -not $IsWindows) { It "Test for Get-Help Get-Disk" -skip:(!(Test-Path (Join-Path -Path $PSHOME -ChildPath Modules\Storage\Storage.psd1)) -or -not $IsWindows) {
try try

View file

@ -210,7 +210,7 @@ Describe "ParserTests (admin\monad\tests\monad\src\engine\core\ParserTests.cs)"
} }
} }
It "Throws an incomplete parse exeception when a comma follows an expression (line 247)" { It "Throws an incomplete parse exception when a comma follows an expression (line 247)" {
try { try {
ExecuteCommand "(1+ 1)," ExecuteCommand "(1+ 1),"
throw "Execution OK" throw "Execution OK"
@ -467,7 +467,7 @@ Describe "ParserTests (admin\monad\tests\monad\src\engine\core\ParserTests.cs)"
} }
} }
It "Test that if an exception is thrown from the try block it will be caught in the apprpropriate catch block and that the finally block will run regardless of whether an exception is thrown. (line 1317)" { It "Test that if an exception is thrown from the try block it will be caught in the appropropriate catch block and that the finally block will run regardless of whether an exception is thrown. (line 1317)" {
$result = ExecuteCommand 'try { try { throw (new-object System.ArgumentException) } catch [System.DivideByZeroException] { } finally { "Finally" } } catch { $_.Exception.GetType().FullName }' $result = ExecuteCommand 'try { try { throw (new-object System.ArgumentException) } catch [System.DivideByZeroException] { } finally { "Finally" } } catch { $_.Exception.GetType().FullName }'
$result | should be "Finally", "System.ArgumentException" $result | should be "Finally", "System.ArgumentException"
} }
@ -771,7 +771,7 @@ Describe "ParserTests (admin\monad\tests\monad\src\engine\core\ParserTests.cs)"
$result | should be "global" $result | should be "global"
} }
It 'Test piping arguments to a script block. The objects should be accesible from "$input". (line 2870)'{ It 'Test piping arguments to a script block. The objects should be accessible from "$input". (line 2870)'{
ExecuteCommand '$script = { $input; };$results = @(0,0),-1 | &$script' ExecuteCommand '$script = { $input; };$results = @(0,0),-1 | &$script'
$result = ExecuteCommand '$results[0][0]' $result = ExecuteCommand '$results[0][0]'
$result | Should be "0" $result | Should be "0"