Skip to content

Commit 37dda0f

Browse files
authored
Update PowerUpSQLTests.ps1
1 parent 0c1b9b7 commit 37dda0f

1 file changed

Lines changed: 83 additions & 1 deletion

File tree

tests/PowerUpSQLTests.ps1

Lines changed: 83 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
Describe "Get-SQLDatabase" {
32
It "Should return results for the local host" {
43
if ( (Get-SQLDatabase | Measure-Object).count -lt 1) {
@@ -346,3 +345,86 @@ Describe "Get-SQLDatabaseUser" {
346345
}
347346
}
348347
}
348+
349+
350+
Describe "Get-SQLConnectionTest" {
351+
It "Should return results for the local host" {
352+
if ( (Get-SQLConnectionTest | Measure-Object).count -lt 1) {
353+
Throw "Incorrect connection test results returned"
354+
}
355+
}
356+
It "Should accept -Instance argument" {
357+
if ( (Get-SQLConnectionTest -Instance $env:COMPUTERNAME | Measure-Object).count -lt 1) {
358+
Throw "Incorrect connection test results returned"
359+
}
360+
}
361+
It "Should accept -Username argument" {
362+
if ( (Get-SQLConnectionTest -Instance $env:COMPUTERNAME -Username test -Password test | Measure-Object).count -lt 1) {
363+
Throw "Incorrect connection test results returned"
364+
}
365+
}
366+
It "Should accept -Password argument" {
367+
if ( (Get-SQLConnectionTest -Instance $env:COMPUTERNAME -Username test -Password test | Measure-Object).count -lt 1) {
368+
Throw "Incorrect connection test results returned"
369+
}
370+
}
371+
It "Should accept -TimeOut argument" {
372+
if ( (Get-SQLConnectionTest -Instance $env:COMPUTERNAME -TimeOut 5 | Measure-Object).count -lt 1) {
373+
Throw "Incorrect connection test results returned"
374+
}
375+
}
376+
It "Should accept -DAC flag" {
377+
if ( (Get-SQLConnectionTest -Instance $env:COMPUTERNAME -DAC| Measure-Object).count -lt 1) {
378+
Throw "Incorrect connection test results returned"
379+
}
380+
}
381+
It "Should accept pipeline input" {
382+
if ( ( Get-SQLInstanceLocal | Get-SQLConnectionTest | Measure-Object).count -lt 1) {
383+
Throw "Incorrect connection test results returned"
384+
}
385+
}
386+
}
387+
388+
389+
Describe "Get-SQLConnectionTestThreaded" {
390+
It "Should return results for the local host" {
391+
if ( (Get-SQLConnectionTestThreaded | Measure-Object).count -lt 1) {
392+
Throw "Incorrect connection test results returned"
393+
}
394+
}
395+
It "Should accept -Instance argument" {
396+
if ( (Get-SQLConnectionTestThreaded -Instance $env:COMPUTERNAME | Measure-Object).count -lt 1) {
397+
Throw "Incorrect connection test results returned"
398+
}
399+
}
400+
It "Should accept -Username argument" {
401+
if ( (Get-SQLConnectionTestThreaded -Instance $env:COMPUTERNAME -Username test -Password test | Measure-Object).count -lt 1) {
402+
Throw "Incorrect connection test results returned"
403+
}
404+
}
405+
It "Should accept -Password argument" {
406+
if ( (Get-SQLConnectionTestThreaded -Instance $env:COMPUTERNAME -Username test -Password test | Measure-Object).count -lt 1) {
407+
Throw "Incorrect connection test results returned"
408+
}
409+
}
410+
It "Should accept -TimeOut argument" {
411+
if ( (Get-SQLConnectionTestThreaded -Instance $env:COMPUTERNAME -TimeOut 5 | Measure-Object).count -lt 1) {
412+
Throw "Incorrect connection test results returned"
413+
}
414+
}
415+
It "Should accept -Threads argument" {
416+
if ( (Get-SQLConnectionTestThreaded -Instance $env:COMPUTERNAME -Threads 5 | Measure-Object).count -lt 1) {
417+
Throw "Incorrect connection test results returned"
418+
}
419+
}
420+
It "Should accept -DAC flag" {
421+
if ( (Get-SQLConnectionTestThreaded -Instance $env:COMPUTERNAME -DAC| Measure-Object).count -lt 1) {
422+
Throw "Incorrect connection test results returned"
423+
}
424+
}
425+
It "Should accept pipeline input" {
426+
if ( ( Get-SQLInstanceLocal | Get-SQLConnectionTestThreaded | Measure-Object).count -lt 1) {
427+
Throw "Incorrect connection test results returned"
428+
}
429+
}
430+
}

0 commit comments

Comments
 (0)