update tests to match

This commit is contained in:
Roy Ashbrook
2021-11-08 15:25:26 -05:00
parent aa1b0018ab
commit 676ecc17e0
2 changed files with 8 additions and 14 deletions

View File

@@ -2,15 +2,12 @@
$scriptPath = $PSScriptRoot
Import-Module $scriptPath\..\..\ImportExcel.psd1 -Force
$tfp = "$scriptPath\Read-OleDbData.xlsx"
$ACEnotWorking = $false
try {
$Results = Invoke-ExcelQuery $tfp "select 1"
}
catch {
$ACEnotWorking = $true
$IsMissingACE = $null -eq ((New-Object system.data.oledb.oledbenumerator).GetElements().SOURCES_NAME -like "Microsoft.ACE.OLEDB*")
if($IsMissingACE){
Write-Host "MICROSOFT.ACE.OLEDB is missing! Tests will be skipped. Please see https://www.microsoft.com/en-us/download/details.aspx?id=54920"
}
Describe "Invoke-ExcelQuery" -Tag "Invoke-ExcelQuery" {
$PSDefaultParameterValues = @{ 'It:Skip' = $ACEnotWorking }
$PSDefaultParameterValues = @{ 'It:Skip' = $IsMissingACE }
Context "Sheet1`$A1" {
It "Should return 1 result with a value of 1" {
$Results = Invoke-ExcelQuery $tfp "select ROUND(F1) as [A1] from [sheet1`$A1:A1]"

View File

@@ -2,16 +2,13 @@
$scriptPath = $PSScriptRoot
Import-Module $scriptPath\..\..\ImportExcel.psd1 -Force
$tfp = "$scriptPath\Read-OleDbData.xlsx"
$ACEnotWorking = $false
$cs = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=$tfp;Extended Properties='Excel 12.0 Xml;HDR=NO;IMEX=1;'"
try {
$Results = Read-OleDbData -ConnectionString $cs -SqlStatement "select 1"
}
catch {
$ACEnotWorking = $true
$IsMissingACE = $null -eq ((New-Object system.data.oledb.oledbenumerator).GetElements().SOURCES_NAME -like "Microsoft.ACE.OLEDB*")
if($IsMissingACE){
Write-Host "MICROSOFT.ACE.OLEDB is missing! Tests will be skipped. Please see https://www.microsoft.com/en-us/download/details.aspx?id=54920"
}
Describe "Read-OleDbData" -Tag "Read-OleDbData" {
$PSDefaultParameterValues = @{ 'It:Skip' = $ACEnotWorking }
$PSDefaultParameterValues = @{ 'It:Skip' = $IsMissingACE }
Context "Basic Tests" {
It "should be able to open spreadsheet" {
$null = Read-OleDbData -ConnectionString $cs -SqlStatement "select 1"