mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-16 00:04:24 +00:00
-Force behavior clearer in Send-SQLData
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
Describe "Exporting with -Inputobject" {
|
||||
Describe "Exporting with -Inputobject; table handling, Send SQL Data and import as " {
|
||||
BeforeAll {
|
||||
$path = "TestDrive:\Results.xlsx"
|
||||
Remove-Item -Path $path -ErrorAction SilentlyContinue
|
||||
@@ -17,8 +17,8 @@ Describe "Exporting with -Inputobject" {
|
||||
export-excel -Path $path -InputObject $DataTable -WorksheetName Sheet2 -AutoNameRange
|
||||
Send-SQLDataToExcel -path $path -DataTable $DataTable -WorkSheetname Sheet3 -TableName "Data"
|
||||
$DataTable.Rows.Clear()
|
||||
Send-SQLDataToExcel -path $path -DataTable $DataTable -WorkSheetname Sheet4 -force
|
||||
Send-SQLDataToExcel -path $path -DataTable ([System.Data.DataTable]::new('Test2')) -WorkSheetname Sheet5 -force
|
||||
Send-SQLDataToExcel -path $path -DataTable $DataTable -WorkSheetname Sheet4 -force -WarningVariable WVOne -WarningAction SilentlyContinue
|
||||
Send-SQLDataToExcel -path $path -DataTable ([System.Data.DataTable]::new('Test2')) -WorkSheetname Sheet5 -force -WarningVariable wvTwo -WarningAction SilentlyContinue
|
||||
$excel = Open-ExcelPackage $path
|
||||
$sheet = $excel.Sheet1
|
||||
}
|
||||
@@ -80,20 +80,23 @@ Describe "Exporting with -Inputobject" {
|
||||
}
|
||||
}
|
||||
$Sheet = $excel.Sheet4
|
||||
Context "Zero row Data Table sent with Send-SQLDataToExcel -Force" {
|
||||
it "Put the correct data headers into the sheet " {
|
||||
Context "Zero-row Data Table sent with Send-SQLDataToExcel -Force" {
|
||||
it "Raised a warning and put the correct data headers into the sheet " {
|
||||
$sheet.Dimension.Rows | should be 1
|
||||
$sheet.Dimension.Columns | should be 5
|
||||
$sheet.cells["A1"].Value | should be "Name"
|
||||
$sheet.cells["E1"].Value | should be "StartTime"
|
||||
$sheet.cells["A3"].Value | should beNullOrEmpty
|
||||
$wvone | should not beNullOrEmpty
|
||||
}
|
||||
}
|
||||
$Sheet = $excel.Sheet5
|
||||
Context "Zero column data table handled by Send-SQLDataToExcel -Force" {
|
||||
it "Put Created a blank Sheet " {
|
||||
Context "Zero-column Data Table handled by Send-SQLDataToExcel -Force" {
|
||||
it "Put Created a blank Sheet and raised a warning " {
|
||||
$sheet.Dimension | should beNullOrEmpty
|
||||
$wvTwo | should not beNullOrEmpty
|
||||
}
|
||||
|
||||
}
|
||||
Close-ExcelPackage $excel
|
||||
Context "Import As Text returns text values" {
|
||||
|
||||
Reference in New Issue
Block a user