Skip to content

Commit b99800f

Browse files
authored
Added test.
Added test for Get-SQLColumnSampleDataThreaded
1 parent 7a41278 commit b99800f

1 file changed

Lines changed: 75 additions & 5 deletions

File tree

tests/PowerUpSQLTests.ps1

Lines changed: 75 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# PowerUpSQL Pester Tests
1+
# PowerUpSQL Pester Tests - Baseline Tests
22

33
######################################################
44
#
@@ -242,22 +242,52 @@ Describe "Get-SQLConnectionTestThreaded" {
242242
######################################################
243243

244244
<#
245-
Get-SQLColumnSampleDataThreaded
246245
Get-SQLAuditDatabaseSpec
247246
Get-SQLAuditServerSpec
248247
Get-SQLServerCredential
249248
Get-SQLServerLink
250249
Get-SQLServerLogin
251250
Get-SQLServerPriv
252251
Get-SQLServerRole
253-
Get-SQLServerRoleMember
254-
Get-SQLServiceAccount
255-
Get-SQLServiceLocal
252+
Get-SQLServerRoleMember
256253
Get-SQLStoredProcedure
257254
Get-SQLTriggerDdl
258255
Get-SQLTriggerDml
259256
#>
260257

258+
# Get-SQLServiceLocal
259+
Describe "Get-SQLServiceLocal" {
260+
It "Should return results for the local host with query" {
261+
if ( (Get-SQLServiceLocal | Measure-Object).count -lt 1) {
262+
Throw "Incorrect service information results returned"
263+
}
264+
}
265+
}
266+
267+
# Get-SQLServiceAccount
268+
Describe "Get-SQLServiceAccount" {
269+
It "Should return results for the local host with query" {
270+
if ( (Get-SQLServiceAccount | Measure-Object).count -lt 1) {
271+
Throw "Incorrect service information results returned"
272+
}
273+
}
274+
It "Should accept -Instance argument" {
275+
if ( (Get-SQLServiceAccount -Instance $env:COMPUTERNAME | Measure-Object).count -lt 1) {
276+
Throw "Incorrect service information results returned"
277+
}
278+
}
279+
It "Should accept -Username and -Password arguments" {
280+
if ( (Get-SQLServiceAccount -Instance $env:COMPUTERNAME -Username test -Password test | Measure-Object).count -lt 1) {
281+
Throw "Incorrect service information results returned"
282+
}
283+
}
284+
It "Should accept pipeline input" {
285+
if ( ( Get-SQLInstanceLocal | Get-SQLServiceAccount | Measure-Object).count -lt 1) {
286+
Throw "Incorrect service information results returned"
287+
}
288+
}
289+
}
290+
261291
# Get-SQLServerInfo
262292
Describe "Get-SQLServerInfo" {
263293
It "Should return results for the local host with query" {
@@ -534,6 +564,46 @@ Describe "Get-SQLColumnSampleData" {
534564
}
535565
}
536566

567+
# Get-SQLColumnSampleDataThreaded
568+
Describe "Get-SQLColumnSampleDataThreaded" {
569+
It "Should return results for the local host" {
570+
if ( (Get-SQLColumnSampleDataThreaded | Measure-Object).count -lt 1) {
571+
Throw "Incorrect threaded column search & sample data results returned"
572+
}
573+
}
574+
It "Should accept -Instance argument" {
575+
if ( (Get-SQLColumnSampleDataThreaded -Instance $env:COMPUTERNAME | Measure-Object).count -lt 1) {
576+
Throw "Incorrect threaded column search & sample data results returned"
577+
}
578+
}
579+
It "Should accept -Username and -Password arguments" {
580+
if ( (Get-SQLColumnSampleDataThreaded -Instance $env:COMPUTERNAME -Username test -Password test -Keywords "statu" | Measure-Object).count -lt 1) {
581+
Throw "Incorrect threaded column search & sample data results returned"
582+
}
583+
}
584+
It "Should accept -Keywords argument" {
585+
if ( (Get-SQLColumnSampleDataThreaded -Instance $env:COMPUTERNAME -Keywords "statu" | Measure-Object).count -lt 1) {
586+
Throw "Incorrect threaded column search & sample data results returned"
587+
}
588+
}
589+
It "Should accept -SampleSize argument" {
590+
if ( (Get-SQLColumnSampleDataThreaded -Instance $env:COMPUTERNAME -Keywords "statu" -SampleSize 2 | Measure-Object).count -lt 1) {
591+
Throw "Incorrect threaded column search & sample data results returned"
592+
}
593+
}
594+
It "Should accept -DatabaseName argument" {
595+
if ( (Get-SQLColumnSampleDataThreaded -Instance $env:COMPUTERNAME -Keywords "statu" -DatabaseName "master" | Measure-Object).count -lt 1) {
596+
Throw "Incorrect threaded column search & sample data results returned"
597+
}
598+
}
599+
600+
It "Should accept pipeline input" {
601+
if ( ( Get-SQLInstanceLocal | Get-SQLColumnSampleDataThreaded -Keywords "statu" | Measure-Object).count -lt 1) {
602+
Throw "Incorrect threaded column search & sample data results returned"
603+
}
604+
}
605+
}
606+
537607
# Get-SQLDatabase
538608
Describe "Get-SQLDatabase" {
539609
It "Should return results for the local host" {

0 commit comments

Comments
 (0)