Merge pull request #915 from PowerShell/andschwa/shared-host-working

Update .NET Core packages
This commit is contained in:
Andy Schwartzmeyer 2016-04-25 15:40:09 -07:00
commit a0f9999119
27 changed files with 915 additions and 707 deletions

View file

@ -190,7 +190,7 @@ function New-PSOptions {
[ValidateSet("Linux", "Debug", "Release")]
[string]$Configuration,
[ValidateSet("netstandardapp1.5", "net451")]
[ValidateSet("netcoreapp1.0", "net451")]
[string]$Framework,
# These are duplicated from Start-PSBuild
@ -229,7 +229,7 @@ function New-PSOptions {
$Framework = if ($FullCLR) {
"net451"
} else {
"netstandardapp1.5"
"netcoreapp1.0"
}
log "Using framework '$Framework'"
}
@ -321,9 +321,14 @@ function Start-PSxUnit {
$Arguments = "--configuration", "Linux"
try {
Push-Location $PSScriptRoot/test/csharp
# Path manipulation to obtain test project output directory
$Output = Join-Path $pwd ((Split-Path -Parent (Get-PSOutput)) -replace (New-PSOptions).Top)
Write-Host "Output is $Output"
Start-NativeExecution { dotnet build $Arguments }
Copy-Item -ErrorAction SilentlyContinue -Recurse -Path $Content/* -Include Modules,libpsl-native* -Destination "./bin/Linux/netstandardapp1.5/ubuntu.14.04-x64"
Copy-Item -ErrorAction SilentlyContinue -Recurse -Path $Content/* -Include Modules,libpsl-native* -Destination $Output
Start-NativeExecution { dotnet test $Arguments }
if ($LASTEXITCODE -ne 0) {
throw "$LASTEXITCODE xUnit tests failed"
}

View file

@ -33,7 +33,7 @@ test_script:
$ErrorActionPreference = 'Stop'
#
# CoreCLR
$env:CoreOutput = "$pwd\src\Microsoft.PowerShell.CoreConsoleHost\bin\Debug\netstandardapp1.5\win81-x64\publish"
$env:CoreOutput = "$pwd\src\Microsoft.PowerShell.CoreConsoleHost\bin\Debug\netcoreapp1.0\win81-x64\publish"
Write-Host -Foreground Green 'Run CoreCLR tests'
$testResultsFile = "$pwd\TestsResults.xml"
& ("$env:CoreOutput\powershell.exe") -c "Invoke-Pester test/powershell -OutputFormat NUnitXml -OutputFile $testResultsFile"

View file

@ -114,7 +114,7 @@ Start-PSBuild
Congratulations! If everything went right, PowerShell is now built.
The `Start-PSBuild` script will output the location of the executable:
`./src/Microsoft.PowerShell.CoreConsoleHost/bin/Linux/netstandardapp1.5/ubuntu.14.04-x64/powershell`.
`./src/Microsoft.PowerShell.CoreConsoleHost/bin/Linux/netcoreapp1.0/ubuntu.14.04-x64/powershell`.
You can run our cross-platform Pester tests with `Start-PSPester`, and
our xUnit tests with `Start-PSxUnit`.
@ -160,7 +160,7 @@ dotnet build --configuration Linux
The executable will be in
`./bin/[configuration]/[framework]/[rid]/[binary name]`, where our
configuration is `Linux`, framework is `netstandardapp1.5`, runtime
configuration is `Linux`, framework is `netcoreapp1.0`, runtime
identifier is `ubuntu.14.04-x64`, and binary name is `powershell`. The
function `Get-PSOutput` will return the path to the executable; thus
you can execute the development copy via `& (Get-PSOutput)`.

View file

@ -49,7 +49,7 @@ module.
The output directory will be slightly different because your runtime
identifier is different. PowerShell will be at
`./src/Microsoft.PowerShell.CoreConsoleHost/bin/Linux/netstandardapp1.5/osx.10.11-x64/powershell`,
`./src/Microsoft.PowerShell.CoreConsoleHost/bin/Linux/netcoreapp1.0/osx.10.11-x64/powershell`,
or `osx.10.10` depending on your operating system version. Note that
configration is still `Linux` because it would be silly to make yet
another separate configuration when it's used soley to work-around a

View file

@ -71,12 +71,12 @@ Start-PSBuild
```
Congratulations! If everything went right, PowerShell is now built and
executable as `./src/Microsoft.PowerShell.CoreConsoleHost/bin/Debug/netstandardapp1.5/win10-x64/powershell`.
executable as `./src/Microsoft.PowerShell.CoreConsoleHost/bin/Debug/netcoreapp1.0/win10-x64/powershell`.
This location is of the form
`./[project]/bin/[configuration]/[framework]/[rid]/[binary name]`, and
our project is `Microsoft.PowerShell.CoreConsoleHost`, configuration is `Debug`
by default, framework is `netstandardapp1.5`, runtime identifier is
by default, framework is `netcoreapp1.0`, runtime identifier is
**probably** `win10-x64` (but will depend on your operating system;
don't worry, `dotnet --info` will tell you what it was), and binary
name is `powershell`. The function `Get-PSOutput` will return the path

View file

@ -51,11 +51,11 @@ module.
Because the `ConsoleHost` project (*not* the `Host` project) is a
library and not an application (in the sense that .NET CLI does not
emit a native executable using .NET Core's `corehost`), it targets the
framework `netstandard1.5`, *not* `netstandardapp1.5`, and the build
framework `netstandard1.5`, *not* `netcoreapp1.0`, and the build
output will *not* have a runtime identifier in the path.
Thus the output location of `powershell.exe` will be
`./src/Microsoft.PowerShell.ConsoleHost/bin/Debug/netstandardapp1.5/powershell.exe`
`./src/Microsoft.PowerShell.ConsoleHost/bin/Debug/netcoreapp1.0/powershell.exe`
While building is easy, running FullCLR version is not as simple as
CoreCLR version.

View file

@ -11,7 +11,6 @@
"warningsAsErrors": true
},
"dependencies": {
"NETStandard.Library": "1.5.0-rc3-24011-00",
"System.Security.SecureString": "1.0.0-*"
}
},

View file

@ -19,8 +19,8 @@
"define": [ "_CORECLR" ]
},
"dependencies": {
"System.Runtime.Serialization.Xml": "4.1.1-rc3-24011-00",
"System.Threading.ThreadPool": "4.0.10-rc3-24011-00"
"System.Runtime.Serialization.Xml": "4.1.1-rc2-24022",
"System.Threading.ThreadPool": "4.0.10-rc2-24022"
}
},
"net451": {

View file

@ -19,8 +19,8 @@
"define": [ "CORECLR" ]
},
"dependencies": {
"System.ServiceProcess.ServiceController": "4.1.0-rc3-24011-00",
"System.Net.NameResolution": "4.0.0-rc3-24011-00"
"System.ServiceProcess.ServiceController": "4.1.0-rc2-24022",
"System.Net.NameResolution": "4.0.0-rc2-24022"
}
},
"net451": {

View file

@ -22,8 +22,8 @@
"define": [ "CORECLR" ]
},
"dependencies": {
"NETStandard.Library": "1.5.0-rc3-24011-00",
"System.Runtime.Loader": "4.0.0-rc3-24011-00"
"NETStandard.Library": "1.5.0-rc2-24022",
"System.Runtime.Loader": "4.0.0-rc2-24022"
}
}
}

View file

@ -23,9 +23,9 @@
"define": [ "CORECLR" ]
},
"dependencies": {
"System.Security.Principal": "4.0.1-rc3-24011-00",
"System.Security.Principal.Windows": "4.0.0-rc3-24011-00",
"System.Diagnostics.TraceSource": "4.0.0-rc3-24011-00",
"System.Security.Principal": "4.0.1-rc2-24022",
"System.Security.Principal.Windows": "4.0.0-rc2-24022",
"System.Diagnostics.TraceSource": "4.0.0-rc2-24022",
"System.Security.SecureString": "1.0.0-*"
}
}

View file

@ -11,8 +11,8 @@
"dependencies": {
"Newtonsoft.Json": "8.0.2",
"System.Xml.XDocument": "4.0.11-rc3-24011-00",
"System.IO.MemoryMappedFiles": "4.0.0-rc3-24011-00",
"System.Xml.XDocument": "4.0.11-rc2-24022",
"System.IO.MemoryMappedFiles": "4.0.0-rc2-24022",
"Microsoft.PowerShell.Commands.Management": "1.0.0-*",
"Microsoft.PowerShell.Commands.Utility": "1.0.0-*"
},
@ -26,8 +26,11 @@
],
"frameworks": {
"netstandardapp1.5": {
"imports": [ "dnxcore50", "portable-net45+win8" ]
"netcoreapp1.0": {
"imports": [ "dnxcore50", "portable-net45+win8" ],
"dependencies": {
"Microsoft.NETCore.App": "1.0.0-rc2-3002485"
}
}
},

View file

@ -30,36 +30,36 @@
"Microsoft.PowerShell.CoreCLR.AssemblyLoadContext": "1.0.0-*",
"Microsoft.PowerShell.CoreCLR.Eventing": "1.0.0-*",
"Microsoft.CSharp": "4.0.1-rc3-24011-00",
"Microsoft.Win32.Registry.AccessControl": "4.0.0-rc3-24011-00",
"System.Collections.Specialized": "4.0.1-rc3-24011-00",
"System.Collections.NonGeneric": "4.0.1-rc3-24011-00",
"System.ComponentModel.EventBasedAsync": "4.0.11-rc3-24011-00",
"System.ComponentModel.TypeConverter": "4.0.1-rc3-24011-00",
"System.Data.Common": "4.0.1-rc3-24011-00",
"System.Diagnostics.Contracts": "4.0.1-rc3-24011-00",
"System.Diagnostics.FileVersionInfo": "4.0.0-rc3-24011-00",
"System.Diagnostics.Process": "4.1.0-rc3-24011-00",
"System.Diagnostics.StackTrace": "4.0.1-rc3-24011-00",
"System.Diagnostics.TraceSource": "4.0.0-rc3-24011-00",
"System.Dynamic.Runtime": "4.0.11-rc3-24011-00",
"System.IO.FileSystem.AccessControl": "4.0.0-rc3-24011-00",
"System.IO.FileSystem.DriveInfo": "4.0.0-rc3-24011-00",
"System.IO.FileSystem.Watcher": "4.0.0-rc3-24011-00",
"System.IO.Pipes": "4.0.0-rc3-24011-00",
"System.Linq.Expressions": "4.0.11-rc3-24011-00",
"System.Net.Http": "4.0.1-rc3-24011-00",
"System.Net.NetworkInformation": "4.1.0-rc3-24011-00",
"System.Reflection.Emit": "4.0.1-rc3-24011-00",
"System.Reflection.Emit.Lightweight": "4.0.1-rc3-24011-00",
"System.Security.AccessControl": "4.0.0-rc3-24011-00",
"System.Security.Cryptography.Algorithms": "4.1.0-rc3-24011-00",
"System.Security.Cryptography.X509Certificates": "4.1.0-rc3-24011-00",
"System.Threading.Thread": "4.0.0-rc3-24011-00",
"System.Threading.Tasks.Parallel": "4.0.1-rc3-24011-00",
"System.Xml.XPath.XmlDocument": "4.0.1-rc3-24011-00",
"System.Xml.XmlDocument": "4.0.1-rc3-24011-00",
"System.Xml.XmlSerializer": "4.0.11-rc3-24011-00"
"Microsoft.CSharp": "4.0.1-rc2-24022",
"Microsoft.Win32.Registry.AccessControl": "4.0.0-rc2-24022",
"System.Collections.Specialized": "4.0.1-rc2-24022",
"System.Collections.NonGeneric": "4.0.1-rc2-24022",
"System.ComponentModel.EventBasedAsync": "4.0.11-rc2-24022",
"System.ComponentModel.TypeConverter": "4.0.1-rc2-24022",
"System.Data.Common": "4.0.1-rc2-24022",
"System.Diagnostics.Contracts": "4.0.1-rc2-24022",
"System.Diagnostics.FileVersionInfo": "4.0.0-rc2-24022",
"System.Diagnostics.Process": "4.1.0-rc2-24022",
"System.Diagnostics.StackTrace": "4.0.1-rc2-24022",
"System.Diagnostics.TraceSource": "4.0.0-rc2-24022",
"System.Dynamic.Runtime": "4.0.11-rc2-24022",
"System.IO.FileSystem.AccessControl": "4.0.0-rc2-24022",
"System.IO.FileSystem.DriveInfo": "4.0.0-rc2-24022",
"System.IO.FileSystem.Watcher": "4.0.0-rc2-24022",
"System.IO.Pipes": "4.0.0-rc2-24022",
"System.Linq.Expressions": "4.0.11-rc2-24022",
"System.Net.Http": "4.0.1-rc2-24022",
"System.Net.NetworkInformation": "4.1.0-rc2-24022",
"System.Reflection.Emit": "4.0.1-rc2-24022",
"System.Reflection.Emit.Lightweight": "4.0.1-rc2-24022",
"System.Security.AccessControl": "4.0.0-rc2-24022",
"System.Security.Cryptography.Algorithms": "4.1.0-rc2-24022",
"System.Security.Cryptography.X509Certificates": "4.1.0-rc2-24022",
"System.Threading.Thread": "4.0.0-rc2-24022",
"System.Threading.Tasks.Parallel": "4.0.1-rc2-24022",
"System.Xml.XPath.XmlDocument": "4.0.1-rc2-24022",
"System.Xml.XmlDocument": "4.0.1-rc2-24022",
"System.Xml.XmlSerializer": "4.0.11-rc2-24022"
}
},
"net451": {

View file

@ -12,7 +12,7 @@
"frameworks": {
"netstandard1.5": {
"dependencies": {
"NETStandard.Library": "1.5.0-rc3-24011-00"
"NETStandard.Library": "1.5.0-rc2-24022"
},
"imports": [ "dnxcore50" ]
}

View file

@ -17,7 +17,7 @@ namespace ConsoleApplication
var outputPath = "../TypeCatalogGen/powershell.inc";
// Get a context for our top level project
var context = ProjectContext.Create("../Microsoft.PowerShell.CoreConsoleHost", NuGetFramework.Parse("netstandardapp1.5"));
var context = ProjectContext.Create("../Microsoft.PowerShell.CoreConsoleHost", NuGetFramework.Parse("netcoreapp1.0"));
System.IO.File.WriteAllLines(outputPath,
// Get the target for the current runtime

View file

@ -10,7 +10,7 @@
},
"frameworks": {
"netstandardapp1.5": {
"netcoreapp1.0": {
"imports": [ "dnxcore50", "portable-net45+win8" ]
}
},

View file

@ -9,7 +9,7 @@
},
"frameworks": {
"netstandardapp1.5": {
"netcoreapp1.0": {
"imports": [ "dnxcore50", "portable-net45+win8" ],
"dependencies": {
"xunit": "2.1.0",

View file

@ -1,35 +1,25 @@
Describe "Format-Custom" {
Context "Check Format-Custom can be called validly." {
It "Should be able to be called without error" {
{ Get-FormatData | Format-Custom } | Should Not Throw
}
It "Should be able to call the fc alias without error" {
{ Get-FormatData | fc } | Should Not Throw
}
}
Context "Check Format-Custom aliases" {
It "Should have the same output between the alias and the unaliased function" {
$nonaliased = Get-FormatData | Format-Custom
$aliased = Get-FormatData | fc
$($nonaliased | Out-String).CompareTo($($aliased | Out-String)) | Should Be 0
}
It "Should have the same output between the alias and the unaliased function" {
$nonaliased = Get-FormatData | Format-Custom
$aliased = Get-FormatData | fc
$($nonaliased | Out-String).CompareTo($($aliased | Out-String)) | Should Be 0
}
}
Context "Check specific flags on Format-Custom" {
It "Should be able to specify the depth in output" {
$getprocesspester = Get-FormatData | Format-Custom -depth 1
($getprocesspester).Count | Should BeGreaterThan 0
}
It "Should be able to specify the depth in output" {
$getprocesspester = Get-FormatData | Format-Custom -depth 1
($getprocesspester).Count | Should BeGreaterThan 0
}
It "Should be able to use the Property flag to select properties" {
$ProcessName = Get-Process | Format-Custom -Property "Name"
$ProcessName | Should Not Match "Handle"
}
It "Should be able to use the Property flag to select properties" {
$CommandName = Get-Command | Format-Custom -Property "Name"
$CommandName | Should Not Match "Source"
}
}
}

View file

@ -1,74 +1,68 @@
Describe "Format-List" {
$nl = [Environment]::NewLine
BeforeEach {
$in = New-Object PSObject
Add-Member -InputObject $in -MemberType NoteProperty -Name testName -Value testValue
$in = New-Object PSObject
Add-Member -InputObject $in -MemberType NoteProperty -Name testName -Value testValue
}
It "Should call format list without error" {
{ $in | Format-List } | Should Not Throw
{ $in | Format-List } | Should Not BeNullOrEmpty
{ $in | Format-List } | Should Not BeNullOrEmpty
}
It "Should be able to call the alias" {
{ $in | fl } | Should Not Throw
{ $in | fl } | Should Not BeNullOrEmpty
{ $in | fl } | Should Not BeNullOrEmpty
}
It "Should have the same output whether choosing alias or not" {
$expected = $in | Format-List | Out-String
$actual = $in | fl | Out-String
$expected = $in | Format-List | Out-String
$actual = $in | fl | Out-String
$actual | Should Be $expected
$actual | Should Be $expected
}
It "Should produce the expected output" {
$expected = "${nl}${nl}testName : testValue${nl}${nl}${nl}${nl}"
$in = New-Object PSObject
Add-Member -InputObject $in -MemberType NoteProperty -Name testName -Value testValue
$expected = "${nl}${nl}testName : testValue${nl}${nl}${nl}${nl}"
$in = New-Object PSObject
Add-Member -InputObject $in -MemberType NoteProperty -Name testName -Value testValue
$in | Format-List | Should Not BeNullOrEmpty
$in | Format-List | Out-String | Should Not BeNullOrEmpty
$in | Format-List | Out-String | Should Be $expected
$in | Format-List | Should Not BeNullOrEmpty
$in | Format-List | Out-String | Should Not BeNullOrEmpty
$in | Format-List | Out-String | Should Be $expected
}
It "Should be able to call a property of the piped input" {
# Tested on two input commands to verify functionality.
{ Get-Process | Format-List -Property Name } | Should Not Throw
{ Get-Process | Format-List -Property Name } | Should Not BeNullOrEmpty
# Tested on two input commands to verify functionality.
{ Get-Command | Format-List -Property Name } | Should Not BeNullOrEmpty
{ Get-Date | Format-List -Property DisplayName } | Should Not Throw
{ Get-Date | Format-List -Property DisplayName } | Should Not BeNullOrEmpty
{ Get-Date | Format-List -Property DisplayName } | Should Not BeNullOrEmpty
}
It "Should be able to display a list of props when separated by a comma" {
{ Get-Process | Format-List -Property Name,BasePriority } | Should Not Throw
(Get-Process | Format-List -Property Name,BasePriority | Out-String) -Split "${nl}" |
Where-Object { $_.trim() -ne "" } |
ForEach-Object { $_ | Should Match "(Name)|(BasePriority)" }
(Get-Command | Format-List -Property Name,Source | Out-String) -Split "${nl}" |
Where-Object { $_.trim() -ne "" } |
ForEach-Object { $_ | Should Match "(Name)|(Source)" }
}
It "Should show the requested prop in every element" {
# Testing each element of format-list, using a for-each loop since the Format-List is so opaque
(Get-Process | Format-List -Property CPU | Out-String) -Split "${nl}" |
Where-Object { $_.trim() -ne "" } |
ForEach-Object { $_ | Should Match "CPU :" }
# Testing each element of format-list, using a for-each loop since the Format-List is so opaque
(Get-Command | Format-List -Property Source | Out-String) -Split "${nl}" |
Where-Object { $_.trim() -ne "" } |
ForEach-Object { $_ | Should Match "Source :" }
}
It "Should not show anything other than the requested props" {
$output = Get-Process | Format-List -Property Name | Out-String
$output = Get-Command | Format-List -Property Name | Out-String
$output | Should Not Match "CPU :"
$output | Should Not Match "Id :"
$output | Should Not Match "Handle :"
$output | Should Not Match "CommandType :"
$output | Should Not Match "Source :"
$output | Should Not Match "Module :"
}
It "Should be able to take input without piping objects to it" {
$output = { Format-List -InputObject $in }
$output = { Format-List -InputObject $in }
$output | Should Not Throw
$output | Should Not BeNullOrEmpty
$output | Should Not BeNullOrEmpty
}
}

View file

@ -1,14 +1,14 @@
Describe "Format-Table" {
It "Should call format table on piped input without error" {
{ Get-Process | Format-Table } | Should Not Throw
{ Get-Date | Format-Table } | Should Not Throw
{ Get-Process | ft } | Should Not Throw
{ Get-Date | ft } | Should Not Throw
}
It "Should return a format object data type" {
$val = (Get-Process | Format-Table | gm )
$val = (Get-Date | Format-Table | gm )
$val2 = (Get-Process | Format-Table | gm )
$val2 = (Get-Date | Format-Table | gm )
$val.TypeName | Should Match "Microsoft.Powershell.Commands.Internal.Format"
@ -16,24 +16,13 @@ Describe "Format-Table" {
}
It "Should be able to be called with optional parameters" {
$v1 = (Get-Process | Format-Table *)
$v2 = (Get-Process | Format-Table -Property ProcessName)
$v3 = (Get-Process | Format-Table -GroupBy ProcessName)
$v4 = (Get-Process | Format-Table -View StartTime)
$v1 = (Get-Date | Format-Table *)
$v2 = (Get-Date | Format-Table -Property Hour)
$v3 = (Get-Date | Format-Table -GroupBy Hour)
$v12 = (Get-Process | ft *)
$v22 = (Get-Process | ft -Property ProcessName)
$v32 = (Get-Process | ft -GroupBy ProcessName)
$v42 = (Get-Process | ft -View StartTime)
$v12 = (Get-Date | ft *)
$v22 = (Get-Date | ft -Property Hour)
$v32 = (Get-Date | ft -GroupBy Hour)
{ $v1 } | Should Not Throw
{ $v2 } | Should Not Throw
{ $v3 } | Should Not Throw
{ $v4 } | Should Not Throw
{ $v12 } | Should Not Throw
{ $v22 } | Should Not Throw
{ $v32 } | Should Not Throw
{ $v42 } | Should Not Throw
}
}

View file

@ -1,40 +1,33 @@
Describe "Format-Wide" {
It "Should be able to call format wide without error" {
{ Get-Process | Format-Wide } | Should Not Throw
}
It "Should be able to use the fw alias without error" {
{ Get-Process | fw } | Should Not Throw
}
It "Should have the same output between the alias and the unaliased function" {
$nonaliased = Get-ChildItem | Format-Wide
$aliased = Get-ChildItem | fw
$nonaliased = Get-ChildItem | Format-Wide
$aliased = Get-ChildItem | fw
$($nonaliased | Out-String).CompareTo($($aliased | Out-String)) | Should Be 0
$($nonaliased | Out-String).CompareTo($($aliased | Out-String)) | Should Be 0
}
It "Should be able to specify the columns in output using the column switch" {
{ ls | Format-Wide -Column 3 } | Should Not Throw
{ ls | Format-Wide -Column 3 } | Should Not Throw
}
It "Should be able to use the autosize switch" {
{ ls | Format-Wide -Autosize } | Should Not Throw
{ ls | Format-Wide -Autosize } | Should Not Throw
}
It "Should be able to take inputobject instead of pipe" {
{ Format-Wide -InputObject $(ls) } | Should Not Throw
{ Format-Wide -InputObject $(ls) } | Should Not Throw
}
It "Should be able to use the property switch" {
{ Format-Wide -InputObject $(ls) -Property Mode } | Should Not Throw
{ Format-Wide -InputObject $(ls) -Property Mode } | Should Not Throw
}
It "Should throw an error when property switch and view switch are used together" {
{ Format-Wide -InputObject $(ls) -Property CreationTime -View aoeu } | Should Throw "Found invalid data"
{ Format-Wide -InputObject $(ls) -Property CreationTime -View aoeu } | Should Throw "Found invalid data"
}
It "Should throw and suggest proper input when view is used with invalid input without the property switch" {
{ Format-Wide -InputObject $(gps) -View aoeu } | Should Throw
{ Format-Wide -InputObject $(gps) -View aoeu } | Should Throw
}
}

View file

@ -163,12 +163,12 @@ Describe "Get-Alias DRT Unit Tests" -Tags DRT{
}
It "Test get-alias with Definition parameter" {
$returnObject = Get-Alias -Definition Get-Process
$returnObject = Get-Alias -Definition Get-Command
For($i = 0; $i -lt $returnObject.Length;$i++)
{
$returnObject[$i] | Should Not BeNullOrEmpty
$returnObject[$i].CommandType | Should Be 'Alias'
$returnObject[$i].Definition | Should Be 'Get-Process'
$returnObject[$i].Definition | Should Be 'Get-Command'
}
}
}

View file

@ -1,10 +1,11 @@
Describe "Get-Process" {
It "Should return a type of Object[] for Get-Process cmdlet" {
(Get-Process).GetType().BaseType | Should Be 'array'
(Get-Process).GetType().Name | Should Be Object[]
# These tests are no good, please replace!
It "Should return a type of Object[] for Get-Process cmdlet" -Pending:$IsOSX {
(Get-Process).GetType().BaseType | Should Be 'array'
(Get-Process).GetType().Name | Should Be Object[]
}
It "Should have not empty Name flags set for Get-Process object" -Pending:$IsOSX {
Get-Process | foreach-object { $_.Name | Should Not BeNullOrEmpty }
Get-Process | foreach-object { $_.Name | Should Not BeNullOrEmpty }
}
}

View file

@ -20,17 +20,6 @@ Describe "Measure-Object" {
$actual | Should Be $expected
}
It "Should be able to get additional stats" {
$actual = Get-Process | Measure-Object -Property workingset64 -Minimum -Maximum -Average
$actual.Average | Should BeGreaterThan 0
$actual.Characters | Should BeNullOrEmpty
$actual.Lines | Should BeNullOrEmpty
$actual.Maximum | Should Not BeNullOrEmpty
$actual.Minimum | Should Not BeNullOrEmpty
$actual.Sum | Should BeNullOrEmpty
}
Context "Numeric tests" {
It "Should be able to sum" {
$actual = $testObject | Measure-Object -Sum

View file

@ -45,10 +45,10 @@ Describe "New-Alias" {
}
It "Should have the same output between the alias and the original cmdlet" {
New-Alias -Name testAlias -Value Get-Process
New-Alias -Name testAlias -Value Get-Command
$aliasId = $(testAlias).Id
$cmdletId = $(Get-Process).Id
$cmdletId = $(Get-Command).Id
foreach ($IdNumber in $aliasId)
{
$aliasId[$IdNumber] | Should Be $cmdletId[$IdNumber]
@ -60,9 +60,9 @@ Describe "New-Alias" {
}
It "Should have the same output between the nal alias and the New-Alias cmdlet" {
nal -Name testAlias -Value Get-Process
nal -Name testAlias -Value Get-Command
New-Alias -Name testalias2 -Value Get-Process
New-Alias -Name testalias2 -Value Get-Command
$aliasData = $(testAlias).Id
$cmdletData = $(testAlias2).Id

View file

@ -3,7 +3,7 @@ Describe "Remove-PSBreakpoint" {
$testScript = Join-Path -Path (Join-Path -Path $PSScriptRoot -ChildPath assets) -ChildPath psbreakpointtestscript.ps1
$script = "`$var = 1
`$var2 = Get-Process
`$var2 = Get-Command
# this is a comment
Get-Date