Skip to content

Commit 9cb3468

Browse files
committed
Adds threads syncronization to the test
1 parent 4f31429 commit 9cb3468

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Orm/Xtensive.Orm.Tests/Issues/IssueGitHub0110_SimpleCommandProcessorOverridesOriginalException.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ namespace Xtensive.Orm.Tests.Issues
8484
{
8585
public class IssueGitHub0110_SimpleCommandProcessorOverridesOriginalException : AutoBuildTest
8686
{
87+
private static ManualResetEvent theStarter;
88+
8789
protected override void CheckRequirements() => Require.ProviderIs(StorageProvider.SqlServer);
8890

8991
protected override DomainConfiguration BuildConfiguration()
@@ -115,6 +117,16 @@ protected override void PopulateData()
115117
}
116118
}
117119

120+
[SetUp]
121+
public void InitStarter() => theStarter = new ManualResetEvent(false);
122+
123+
[TearDown]
124+
public void DisposeStarter()
125+
{
126+
theStarter.DisposeSafely();
127+
theStarter = null;
128+
}
129+
118130
[Test]
119131
public void MainTest()
120132
{
@@ -126,6 +138,10 @@ public void MainTest()
126138
task1.Start();
127139
task2.Start();
128140

141+
Thread.Sleep(500);
142+
143+
_ = theStarter.Set();
144+
129145
while (!task1State.Ended && !task1State.Ended) {
130146
Thread.Sleep(100);
131147
}
@@ -138,6 +154,8 @@ public void MainTest()
138154
private static void Outer(object state)
139155
{
140156
var operationState = (OperationState) state;
157+
158+
_ = theStarter.WaitOne();
141159
try {
142160
using (var session = operationState.Domain.OpenSession(SessionType.User))
143161
using (var tx = session.OpenTransaction()) {

0 commit comments

Comments
 (0)