mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-10 13:23:29 +00:00
Samples tests workaround for Linux
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
#Requires -Modules Pester
|
#Requires -Modules Pester
|
||||||
#Import-Module $PSScriptRoot\..\ImportExcel.psd1 -Force
|
#Import-Module $PSScriptRoot\..\ImportExcel.psd1 -Force
|
||||||
|
. "$PSScriptRoot\Samples\Samples.ps1"
|
||||||
if ($PSVersionTable.PSVersion.Major -gt 5) { Write-Warning "Can't test grid view on V6 and later" }
|
if ($PSVersionTable.PSVersion.Major -gt 5) { Write-Warning "Can't test grid view on V6 and later" }
|
||||||
else {Add-Type -AssemblyName System.Windows.Forms }
|
else {Add-Type -AssemblyName System.Windows.Forms }
|
||||||
Describe "Compare Worksheet" {
|
Describe "Compare Worksheet" {
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
#Requires -Modules Pester
|
#Requires -Modules Pester
|
||||||
|
|
||||||
Import-Module $PSScriptRoot\..\ImportExcel.psd1 -Force
|
#Import-Module $PSScriptRoot\..\ImportExcel.psd1 -Force
|
||||||
if (-not $env:TEMP) {$env:TEMP = [IO.Path]::GetTempPath() -replace "/$","" }
|
. "$PSScriptRoot\Samples\Samples.ps1"
|
||||||
$notWindows = ($PSVersionTable.os -and $PSVersionTable.os -notMatch 'Windows' )
|
|
||||||
|
|
||||||
if (Get-process -Name Excel,xlim -ErrorAction SilentlyContinue) { Write-Warning -Message "You need to close Excel before running the tests." ; return}
|
if (Get-process -Name Excel,xlim -ErrorAction SilentlyContinue) { Write-Warning -Message "You need to close Excel before running the tests." ; return}
|
||||||
Describe ExportExcel {
|
Describe ExportExcel {
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ ID,Product,Quantity,Price,Total
|
|||||||
12010,Drill,11,8,88
|
12010,Drill,11,8,88
|
||||||
12012,Pliers,3,14.99,44.97
|
12012,Pliers,3,14.99,44.97
|
||||||
"@
|
"@
|
||||||
|
. "$PSScriptRoot\Samples\Samples.ps1"
|
||||||
|
|
||||||
Describe "Join Worksheet part 1" {
|
Describe "Join Worksheet part 1" {
|
||||||
BeforeAll {
|
BeforeAll {
|
||||||
|
|||||||
BIN
__tests__/Samples/Get-CimInstanceDisk.xml
Normal file
BIN
__tests__/Samples/Get-CimInstanceDisk.xml
Normal file
Binary file not shown.
BIN
__tests__/Samples/Get-CimInstanceNetAdapter.xml
Normal file
BIN
__tests__/Samples/Get-CimInstanceNetAdapter.xml
Normal file
Binary file not shown.
29880
__tests__/Samples/Get-Process.xml
Normal file
29880
__tests__/Samples/Get-Process.xml
Normal file
File diff suppressed because it is too large
Load Diff
BIN
__tests__/Samples/Get-Service.xml
Normal file
BIN
__tests__/Samples/Get-Service.xml
Normal file
Binary file not shown.
38
__tests__/Samples/Samples.ps1
Normal file
38
__tests__/Samples/Samples.ps1
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
<#
|
||||||
|
Get-Service | Select-Object -First 30 | Export-Clixml -Path Get-Service.xml
|
||||||
|
|
||||||
|
$Disk = Get-CimInstance -ClassName win32_logicaldisk | Select-Object -Property DeviceId,VolumeName, Size,Freespace
|
||||||
|
$Disk | Export-Clixml -Path Get-CimInstanceDisk.xml
|
||||||
|
|
||||||
|
$NetAdapter = Get-CimInstance -Namespace root/StandardCimv2 -class MSFT_NetAdapter | Select-Object -Property Name, InterfaceDescription, MacAddress, LinkSpeed
|
||||||
|
$NetAdapter | Export-Clixml -Path Get-CimInstanceNetAdapter.xml
|
||||||
|
|
||||||
|
$Process = Get-Process | Where-Object { $_.StartTime } | Select-Object -first 20
|
||||||
|
$Process | Export-Clixml -Path Get-Process.xml
|
||||||
|
#>
|
||||||
|
|
||||||
|
if ($IsLinux -or $IsMacOS) {
|
||||||
|
if (-not (Get-Command 'Get-Service' -ErrorAction SilentlyContinue)) {
|
||||||
|
function Get-Service {
|
||||||
|
Import-Clixml -Path (Join-Path $PSScriptRoot Get-Service.xml)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (-not (Get-Command 'Get-CimInstance' -ErrorAction SilentlyContinue)) {
|
||||||
|
function Get-CimInstance {
|
||||||
|
param (
|
||||||
|
$ClassName,
|
||||||
|
$Namespace,
|
||||||
|
$class
|
||||||
|
)
|
||||||
|
if ($ClassName -eq 'win32_logicaldisk') {
|
||||||
|
Import-Clixml -Path (Join-Path $PSScriptRoot Get-CimInstanceDisk.xml)
|
||||||
|
}
|
||||||
|
elseif ($class -eq 'MSFT_NetAdapter') {
|
||||||
|
Import-Clixml -Path (Join-Path $PSScriptRoot Get-CimInstanceNetAdapter.xml)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function Get-Process {
|
||||||
|
Import-Clixml -Path (Join-Path $PSScriptRoot Get-Process.xml)
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user