Skip to content

Commit e88cc48

Browse files
fix OcDispatcherTests.DisposeTest
1 parent f5fb07f commit e88cc48

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/ObservableComputations.Test/OcDispatcherTests.cs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -443,8 +443,8 @@ public void DisposeTest()
443443
bool invoked1 = false;
444444
bool invoked2 = false;
445445
bool freezed = false;
446-
InvocationResult<bool> invocationResult = null;
447446
InvocationResult<bool> invocationResult1 = null;
447+
InvocationResult<bool> invocationResult2 = null;
448448

449449
dispatcher.InvokeAsync(() =>
450450
{
@@ -455,7 +455,13 @@ public void DisposeTest()
455455
});
456456

457457

458-
invocationResult = dispatcher.Invoke(() => invoked1 = true);
458+
invocationResult1 = dispatcher.Invoke(() =>
459+
{
460+
mre.Wait();
461+
invoked1 = true;
462+
return true;
463+
});
464+
459465
});
460466

461467
Thread thread = new Thread(
@@ -466,7 +472,12 @@ public void DisposeTest()
466472

467473
}
468474

469-
invocationResult1 = dispatcher.Invoke(() => invoked2 = true);
475+
invocationResult2 = dispatcher.Invoke(() =>
476+
{
477+
mre.Wait();
478+
invoked2 = true;
479+
return true;
480+
});
470481
});
471482
thread.Start();
472483

@@ -490,8 +501,8 @@ public void DisposeTest()
490501

491502
Assert.IsFalse(invoked1);
492503
Assert.IsFalse(invoked2);
493-
Assert.AreEqual(invocationResult.Invocation.Status, InvocationStatus.Canceled);
494504
Assert.AreEqual(invocationResult1.Invocation.Status, InvocationStatus.Canceled);
505+
Assert.AreEqual(invocationResult2.Invocation.Status, InvocationStatus.Canceled);
495506
}
496507

497508
[Test]

0 commit comments

Comments
 (0)