Skip to content

Commit

Permalink
Update ConvertFrom-SourceTable.Tests.ps1
Browse files Browse the repository at this point in the history
  • Loading branch information
iRon7 authored Mar 27, 2020
1 parent c58bcf5 commit fe4be73
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions Tests/ConvertFrom-SourceTable.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1695,5 +1695,35 @@ A B XY ZY

}

It 'convert list output to table(object)' { # https://stackoverflow.com/a/60882963/1701026

$Table = '
[ ID] Interval Transfer Bandwidth
[ 4] 0.00-1.00 sec 11.4 MBytes 95.4 Mbits/sec
[ 4] 1.00-2.00 sec 11.2 MBytes 94.2 Mbits/sec
[ 4] 2.00-3.00 sec 11.2 MBytes 94.3 Mbits/sec
[ 4] 3.00-4.00 sec 11.2 MBytes 94.5 Mbits/sec
[ 4] 4.00-5.00 sec 11.2 MBytes 94.2 Mbits/sec
[ 4] 5.00-6.00 sec 11.2 MBytes 94.4 Mbits/sec
[ 4] 6.00-7.00 sec 11.2 MBytes 94.4 Mbits/sec
[ 4] 7.00-8.00 sec 11.2 MBytes 94.3 Mbits/sec
[ 4] 8.00-9.00 sec 11.2 MBytes 94.2 Mbits/sec
[ 4] 9.00-10.00 sec 11.2 MBytes 94.5 Mbits/sec'

$Actual = $Table | ConvertFrom-SourceTable -Literal -Omit '[]'

,$Actual | Differentiate @(
[pscustomobject]@{'ID' = '4'; 'Interval' = '0.00-1.00 sec'; 'Transfer' = '11.4 MBytes'; 'Bandwidth' = '95.4 Mbits/sec'},
[pscustomobject]@{'ID' = '4'; 'Interval' = '1.00-2.00 sec'; 'Transfer' = '11.2 MBytes'; 'Bandwidth' = '94.2 Mbits/sec'},
[pscustomobject]@{'ID' = '4'; 'Interval' = '2.00-3.00 sec'; 'Transfer' = '11.2 MBytes'; 'Bandwidth' = '94.3 Mbits/sec'},
[pscustomobject]@{'ID' = '4'; 'Interval' = '3.00-4.00 sec'; 'Transfer' = '11.2 MBytes'; 'Bandwidth' = '94.5 Mbits/sec'},
[pscustomobject]@{'ID' = '4'; 'Interval' = '4.00-5.00 sec'; 'Transfer' = '11.2 MBytes'; 'Bandwidth' = '94.2 Mbits/sec'},
[pscustomobject]@{'ID' = '4'; 'Interval' = '5.00-6.00 sec'; 'Transfer' = '11.2 MBytes'; 'Bandwidth' = '94.4 Mbits/sec'},
[pscustomobject]@{'ID' = '4'; 'Interval' = '6.00-7.00 sec'; 'Transfer' = '11.2 MBytes'; 'Bandwidth' = '94.4 Mbits/sec'},
[pscustomobject]@{'ID' = '4'; 'Interval' = '7.00-8.00 sec'; 'Transfer' = '11.2 MBytes'; 'Bandwidth' = '94.3 Mbits/sec'},
[pscustomobject]@{'ID' = '4'; 'Interval' = '8.00-9.00 sec'; 'Transfer' = '11.2 MBytes'; 'Bandwidth' = '94.2 Mbits/sec'},
[pscustomobject]@{'ID' = '4'; 'Interval' = '9.00-10.00 sec'; 'Transfer' = '11.2 MBytes'; 'Bandwidth' = '94.5 Mbits/sec'}
) | Should -Be 0
}
}
}

0 comments on commit fe4be73

Please sign in to comment.