Skip to content

Commit ab07cc2

Browse files
Prevent test hos crash during test
1 parent 5c26004 commit ab07cc2

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Source/tests/Csla.test/ValidationRules/AsyncRuleTests.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ public async Task AsyncRuleException_Testcase01()
167167
var diContext = CreateDIContextForAsyncRuleExceptions();
168168

169169
var unhandledExceptionHandler = (TestUnhandledAsyncRuleExceptionHandler)diContext.ServiceProvider.GetRequiredService<IUnhandledAsyncRuleExceptionHandler>();
170+
unhandledExceptionHandler.CanHandleResult = true; // Otherwise the test host process will be crashed
170171

171172
var cp = diContext.CreateDataPortal<DelayedAsyncRuleExceptionRoot>();
172173
var bo = await cp.CreateAsync();
@@ -185,6 +186,7 @@ public async Task AsyncRuleException_Testcase02()
185186
var diContext = CreateDIContextForAsyncRuleExceptions();
186187

187188
var unhandledExceptionHandler = (TestUnhandledAsyncRuleExceptionHandler)diContext.ServiceProvider.GetRequiredService<IUnhandledAsyncRuleExceptionHandler>();
189+
unhandledExceptionHandler.CanHandleResult = true; // Otherwise the test host process will be crashed
188190

189191
var cp = diContext.CreateDataPortal<DelayedAsyncRuleExceptionRoot>();
190192
var bo = await cp.CreateAsync();
@@ -199,6 +201,7 @@ public async Task AsyncRuleException_Testcase02()
199201
canHandleInvoked.Should().BeTrue();
200202
}
201203

204+
[Ignore("This test can be run but will crash the test host, so this is failing any CI build. But for completness it's here and can be run if necessary.")]
202205
[TestMethod($"When the default {nameof(IUnhandledAsyncRuleExceptionHandler)} is used the exception must be handled by a global unhandled exception handler (for this test it's the {nameof(AppDomain)}.{nameof(AppDomain.CurrentDomain)}.{nameof(AppDomain.CurrentDomain.UnhandledException)} event).")]
203206
public async Task AsyncRuleException_Testcase03()
204207
{

0 commit comments

Comments
 (0)