@@ -13,7 +13,7 @@ namespace PSql.Tests.Integration;
1313
1414[ TestFixture ]
1515[ Parallelizable ( ParallelScope . All ) ]
16- public class InvokeSqlCommandTests
16+ public class InvokeSqlCommandIntegrationTests
1717{
1818 [ OneTimeSetUp ]
1919 public static void SetUpOnce ( )
@@ -22,6 +22,54 @@ public static void SetUpOnce()
2222 _ = Prelude ;
2323 }
2424
25+ [ Test ]
26+ public void Invoke_Default ( )
27+ {
28+ var ( output , exception ) = Execute (
29+ """
30+ PSql\Invoke-Sql "PRINT 'a';"
31+ """ ) ;
32+
33+ exception . ShouldBeNull ( ) ;
34+
35+ output . ShouldHaveSingleItem ( ) . ShouldNotBeNull ( )
36+ . BaseObject . ShouldBe ( new PSInformation ( "a" ) ) ;
37+ }
38+
39+ [ Test ]
40+ public void Invoke_Context ( )
41+ {
42+ var ( output , exception ) = Execute (
43+ """
44+ PSql\Invoke-Sql -Context $Context "PRINT 'a';"
45+ """ ) ;
46+
47+ exception . ShouldBeNull ( ) ;
48+
49+ output . ShouldHaveSingleItem ( ) . ShouldNotBeNull ( )
50+ . BaseObject . ShouldBe ( new PSInformation ( "a" ) ) ;
51+ }
52+
53+ [ Test ]
54+ public void Invoke_Connection ( )
55+ {
56+ var ( output , exception ) = Execute (
57+ """
58+ $Connection = PSql\Connect-Sql
59+ try {
60+ PSql\Invoke-Sql -Connection $Connection "PRINT 'a';"
61+ }
62+ finally {
63+ PSql\Disconnect-Sql $Connection
64+ }
65+ """ ) ;
66+
67+ exception . ShouldBeNull ( ) ;
68+
69+ output . ShouldHaveSingleItem ( ) . ShouldNotBeNull ( )
70+ . BaseObject . ShouldBe ( new PSInformation ( "a" ) ) ;
71+ }
72+
2573 [ Test ]
2674 public void ProjectBit_ToClrBoolean ( )
2775 {
0 commit comments