File tree Expand file tree Collapse file tree 2 files changed +39
-2
lines changed
Expand file tree Collapse file tree 2 files changed +39
-2
lines changed Original file line number Diff line number Diff line change 11// Copyright Subatomix Research Inc.
22// SPDX-License-Identifier: MIT
33
4+ using Markdig . Extensions . Footers ;
45using PSql . Commands ;
56
67namespace PSql . Tests ;
@@ -26,7 +27,28 @@ public void Dispose_ConnectionNullified()
2627 cmdlet . Dispose ( ) ; // To test multiple disposal
2728 }
2829
29- private class TestCmdletA : ConnectedCmdlet { }
30+ [ Test ]
31+ public void AssumeBeginProcessingInvoked_NotInvoked ( )
32+ {
33+ var cmdlet = new TestCmdletA ( ) ;
34+
35+ #if DEBUG
36+ Should . Throw < InvalidOperationException > (
37+ ( ) => cmdlet . AssumeBeginProcessingInvoked ( )
38+ ) ;
39+ #else
40+ // No-op in release builds
41+ cmdlet . AssumeBeginProcessingInvoked ( ) ;
42+ #endif
43+ }
44+
45+ private class TestCmdletA : ConnectedCmdlet
46+ {
47+ public new void AssumeBeginProcessingInvoked ( )
48+ {
49+ base . AssumeBeginProcessingInvoked ( ) ;
50+ }
51+ }
3052
3153 private class TestCmdletB : ConnectedCmdlet
3254 {
Original file line number Diff line number Diff line change @@ -18,8 +18,23 @@ public void ProcessRecord_NullSql()
1818 new TestCommand ( ) . ProcessRecord ( ) ;
1919 }
2020
21+ [ Test ]
22+ public void StopProcessing ( )
23+ {
24+ var command = new TestCommand { Sql = [ "--" ] } ;
25+
26+ command . BeginProcessing ( ) ;
27+ command . StopProcessing ( ) ;
28+
29+ Should . Throw < OperationCanceledException > (
30+ ( ) => command . ProcessRecord ( )
31+ ) ;
32+ }
33+
2134 private class TestCommand : InvokeSqlCommand
2235 {
23- public new void ProcessRecord ( ) => base . ProcessRecord ( ) ;
36+ public new void BeginProcessing ( ) => base . BeginProcessing ( ) ;
37+ public new void ProcessRecord ( ) => base . ProcessRecord ( ) ;
38+ public new void StopProcessing ( ) => base . StopProcessing ( ) ;
2439 }
2540}
You can’t perform that action at this time.
0 commit comments