Update fix based on comments for Measure-Object Pester Test

This commit is contained in:
JumpingYang001 committed 2016-05-31 22:04:50 -07:00
1 parent ef10c6c02d
commit e13115ed78
1 file changed
+12 -6
+12 -6
View File
@@ -14,8 +14,8 @@ Describe "Measure-Object" {
} }
It "Should be able to count using the Property switch" { It "Should be able to count using the Property switch" {
$expected = $(Get-ChildItem).Length $expected = $(Get-ChildItem $TestDrive).Length
$actual = $(Get-ChildItem | Measure-Object -Property Length).Count $actual = $(Get-ChildItem $TestDrive | Measure-Object -Property Length).Count
$actual | Should Be $expected $actual | Should Be $expected
} }
@@ -143,7 +143,11 @@ Describe "Measure-Object" {
} }
Describe "Measure-Object DRT basic functionality" -Tags DRT{ Describe "Measure-Object DRT basic functionality" -Tags DRT{
Add-Type -TypeDefinition @"
BeforeAll {
if(-not ([System.Management.Automation.PSTypeName]'TestMeasureGeneric').Type)
{
Add-Type -TypeDefinition @"
[System.Flags] [System.Flags]
public enum TestMeasureGeneric : uint public enum TestMeasureGeneric : uint
{ {
@@ -153,7 +157,10 @@ Describe "Measure-Object DRT basic functionality" -Tags DRT{
TestMin = 8 TestMin = 8
} }
"@ "@
Add-Type -TypeDefinition @" }
if(-not ([System.Management.Automation.PSTypeName]'TestMeasureText').Type)
{
Add-Type -TypeDefinition @"
[System.Flags] [System.Flags]
public enum TestMeasureText : uint public enum TestMeasureText : uint
{ {
@@ -163,8 +170,7 @@ Describe "Measure-Object DRT basic functionality" -Tags DRT{
TestLine = 8 TestLine = 8
} }
"@ "@
}
BeforeAll {
$employees = [pscustomobject]@{"FirstName"="joseph"; "LastName"="smith"; "YearsInMS"=15}, $employees = [pscustomobject]@{"FirstName"="joseph"; "LastName"="smith"; "YearsInMS"=15},
[pscustomobject]@{"FirstName"="paul"; "LastName"="smith"; "YearsInMS"=15}, [pscustomobject]@{"FirstName"="paul"; "LastName"="smith"; "YearsInMS"=15},
[pscustomobject]@{"FirstName"="mary jo"; "LastName"="soe"; "YearsInMS"=5}, [pscustomobject]@{"FirstName"="mary jo"; "LastName"="soe"; "YearsInMS"=5},