Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions test/docker/networktest/DockerRemoting.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -69,21 +69,21 @@ Describe "Basic remoting test with docker" -tags @("Scenario","Slow"){

It "Full powershell can get correct remote powershell version" -pending:$pending {
$result = docker exec $client powershell -c "`$ss = [security.securestring]::new(); '11aa!!AA'.ToCharArray() | ForEach-Object { `$ss.appendchar(`$_)}; `$c = [pscredential]::new('testuser',`$ss); `$ses=new-pssession $serverhostname -configurationname $powershellcoreConfiguration -auth basic -credential `$c; invoke-command -session `$ses { `$psversiontable.psversion.tostring() }"
$result | should be $coreVersion
$result | Should -Be $coreVersion
}

It "Full powershell can get correct remote powershell full version" -pending:$pending {
$result = docker exec $client powershell -c "`$ss = [security.securestring]::new(); '11aa!!AA'.ToCharArray() | ForEach-Object { `$ss.appendchar(`$_)}; `$c = [pscredential]::new('testuser',`$ss); `$ses=new-pssession $serverhostname -auth basic -credential `$c; invoke-command -session `$ses { `$psversiontable.psversion.tostring() }"
$result | should be $fullVersion
$result | Should -Be $fullVersion
}

It "Core powershell can get correct remote powershell version" -pending:$pending {
$result = docker exec $client "$powershellcorepath" -c "`$ss = [security.securestring]::new(); '11aa!!AA'.ToCharArray() | ForEach-Object { `$ss.appendchar(`$_)}; `$c = [pscredential]::new('testuser',`$ss); `$ses=new-pssession $serverhostname -configurationname $powershellcoreConfiguration -auth basic -credential `$c; invoke-command -session `$ses { `$psversiontable.psversion.tostring() }"
$result | should be $coreVersion
$result | Should -Be $coreVersion
}

It "Core powershell can get correct remote powershell full version" -pending:$pending {
$result = docker exec $client "$powershellcorepath" -c "`$ss = [security.securestring]::new(); '11aa!!AA'.ToCharArray() | ForEach-Object { `$ss.appendchar(`$_)}; `$c = [pscredential]::new('testuser',`$ss); `$ses=new-pssession $serverhostname -auth basic -credential `$c; invoke-command -session `$ses { `$psversiontable.psversion.tostring() }"
$result | should be $fullVersion
$result | Should -Be $fullVersion
}
}
2 changes: 1 addition & 1 deletion test/nanoserver/nanoserver.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ Describe "Verify PowerShell Runs" {

it "Verify Version " {
$version = docker run --rm -v "${rootPath}:${mount}" ${container} "${mount}\publish\pwsh" -NoLogo -NoProfile -Command '$PSVersionTable.PSVersion.ToString()'
$version | Should -match '^7\.'
$version | Should -Match '^7\.'
}
}
8 changes: 4 additions & 4 deletions test/powershell/Host/Logging.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ $pid
$items | Should -Not -Be $null
$items.Count | Should -BeGreaterThan 2
$createdEvents = $items | where-object {$_.EventId -eq 'ScriptBlock_Compile_Detail:ExecuteCommand.Create.Verbose'}
$createdEvents.Count | should -BeGreaterOrEqual 3
$createdEvents.Count | Should -BeGreaterOrEqual 3

# Verify we log that we are executing a file
$createdEvents[0].Message | Should -Match ($scriptBlockCreatedRegExTemplate -f ".*/$testFileName")
Expand Down Expand Up @@ -234,7 +234,7 @@ $pid
$items | Should -Not -Be $null
$items.Count | Should -BeGreaterThan 2
$createdEvents = $items | where-object {$_.EventId -eq 'ScriptBlock_Compile_Detail:ExecuteCommand.Create.Verbose'}
$createdEvents.Count | should -BeGreaterOrEqual 3
$createdEvents.Count | Should -BeGreaterOrEqual 3

# Verify we log that we are executing a file
$createdEvents[0].Message | Should -Match ($scriptBlockCreatedRegExTemplate -f ".*/$testFileName")
Expand Down Expand Up @@ -354,7 +354,7 @@ $pid
$items | Should -Not -Be $null
$items.Count | Should -BeGreaterThan 2
$createdEvents = $items | where-object {$_.EventId -eq 'ScriptBlock_Compile_Detail:ExecuteCommand.Create.Verbose'}
$createdEvents.Count | should -BeGreaterOrEqual 3
$createdEvents.Count | Should -BeGreaterOrEqual 3

# Verify we log that we are executing a file
$createdEvents[0].Message | Should -Match ($scriptBlockCreatedRegExTemplate -f ".*/$testFileName")
Expand Down Expand Up @@ -392,7 +392,7 @@ $pid
$items | Should -Not -Be $null
$items.Count | Should -BeGreaterThan 2
$createdEvents = $items | where-object {$_.EventId -eq 'ScriptBlock_Compile_Detail:ExecuteCommand.Create.Verbose'}
$createdEvents.Count | should -BeGreaterOrEqual 3
$createdEvents.Count | Should -BeGreaterOrEqual 3

# Verify we log that we are executing a file
$createdEvents[0].Message | Should -Match ($scriptBlockCreatedRegExTemplate -f ".*/$testFileName")
Expand Down
6 changes: 3 additions & 3 deletions test/powershell/Host/TabCompletion/TabCompletion.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,14 @@ Describe "TabCompletion" -Tags CI {
$res = TabExpansion2 -inputScript 'Get-ChildItem | Select-Object @{ ' -cursorColumn 'Get-ChildItem | Select-Object @{ '.Length
$res.CompletionMatches | Should -HaveCount 2
$completionText = $res.CompletionMatches.CompletionText | Sort-Object
$completionText -join ' '| Should -BeExactly 'Expression Name'
$completionText -join ' ' | Should -BeExactly 'Expression Name'
}

It 'Should complete Sort-Object hashtable' {
$res = TabExpansion2 -inputScript 'Get-ChildItem | Sort-Object @{ ' -cursorColumn 'Get-ChildItem | Sort-Object @{ '.Length
$res.CompletionMatches | Should -HaveCount 3
$completionText = $res.CompletionMatches.CompletionText | Sort-Object
$completionText -join ' '| Should -BeExactly 'Ascending Descending Expression'
$completionText -join ' ' | Should -BeExactly 'Ascending Descending Expression'
}

It 'Should complete New-Object hashtable' {
Expand Down Expand Up @@ -375,7 +375,7 @@ Describe "TabCompletion" -Tags CI {
$res = TabExpansion2 -inputScript 'Export-Counter -FileFormat ' -cursorColumn 'Export-Counter -FileFormat '.Length
$res.CompletionMatches | Should -HaveCount 3
$completionText = $res.CompletionMatches.CompletionText | Sort-Object
$completionText -join ' '| Should -BeExactly 'blg csv tsv'
$completionText -join ' ' | Should -BeExactly 'blg csv tsv'
}

Context "Script name completion" {
Expand Down
2 changes: 1 addition & 1 deletion test/powershell/Installer/WindowsInstaller.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Describe "Windows Installer" -Tags "Scenario" {

It "WiX (Windows Installer XML) file contains pre-requisites link $preRequisitesLink" -skip:$skipTest {
$wixProductFile = Join-Path -Path $PSScriptRoot -ChildPath "..\..\..\assets\Product.wxs"
(Get-Content $wixProductFile -Raw).Contains($preRequisitesLink) | Should Be $true
(Get-Content $wixProductFile -Raw).Contains($preRequisitesLink) | Should -BeTrue
}

## Running 'Invoke-WebRequest' with WMF download URLs has been failing intermittently,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ Describe 'Negative ClassAttributes Tests' -Tags "CI" {

[System.Management.Automation.Cmdlet("Get", "Thing", SupportsShouldProcess = $true, SupportsPaging = $true)]class C2{}
$t = [C2].GetCustomAttributes($false)
It "Should have one attribute (class C2)" { $t.Count | should -Be 1 }
It "Should have one attribute (class C2)" { $t.Count | Should -Be 1 }
It "Should have instance of CmdletAttribute (class C2)" { $t[0] | Should -BeOfType System.Management.Automation.CmdletAttribute }
[System.Management.Automation.CmdletAttribute]$c = $t[0]
It "Verb should be Get (class C2)" {$c.VerbName | Should -BeExactly 'Get'}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Describe 'Classes inheritance syntax' -Tags "CI" {
$C1 = Invoke-Expression 'class ClassWithInterfaceProperty : InterfaceWithProperty { [int]$Integer } [ClassWithInterfaceProperty]::new()'
$getter = $C1.GetType().GetMember('get_Integer')
$getter.ReturnType.FullName | Should -Be System.Int32
$getter.Attributes -band [System.Reflection.MethodAttributes]::Virtual |Should -Be ([System.Reflection.MethodAttributes]::Virtual)
$getter.Attributes -band [System.Reflection.MethodAttributes]::Virtual | Should -Be ([System.Reflection.MethodAttributes]::Virtual)
}

It 'can implement inherited .NET interface properties' {
Expand All @@ -77,7 +77,7 @@ Describe 'Classes inheritance syntax' -Tags "CI" {
$C1 = Invoke-Expression 'class ClassWithInheritedInterfaces : IChild { [int]$ParentInteger; [int]$ChildInteger } [ClassWithInheritedInterfaces]'
$getter = $C1.GetMember('get_ParentInteger')
$getter.ReturnType.FullName | Should -Be System.Int32
$getter.Attributes -band [System.Reflection.MethodAttributes]::Virtual |Should -Be ([System.Reflection.MethodAttributes]::Virtual)
$getter.Attributes -band [System.Reflection.MethodAttributes]::Virtual | Should -Be ([System.Reflection.MethodAttributes]::Virtual)
}

It 'allows use of defined later type as a property type' {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ namespace DotNetInterop
{ $testObj.PrintMySpan("abc", 12) } | Should -Throw -ErrorId "MethodArgumentConversionInvalidCastArgument"

$path = [System.IO.Path]::GetTempPath()
[System.IO.Path]::IsPathRooted($path.ToCharArray()) | Should -Be $true
[System.IO.Path]::IsPathRooted($path.ToCharArray()) | Should -BeTrue
}

It "Support constructor calls with ByRef-like parameter as long as the argument can be casted to the ByRef-like type" {
Expand Down
Loading