Skip to content

Commit 7b31dc0

Browse files
Tests: DisableTestParallelization (#355)
1 parent a2d415e commit 7b31dc0

22 files changed

Lines changed: 147 additions & 155 deletions

File tree

net/DevExtreme.AspNet.Data.Tests.Common/StaticBarrier.cs

Lines changed: 0 additions & 25 deletions
This file was deleted.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
using Xunit;
2+
3+
[assembly: CollectionBehavior(DisableTestParallelization = true)]

net/DevExtreme.AspNet.Data.Tests.EF6/DevExtreme.AspNet.Data.Tests.EF6.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
<None Include="packages.config" />
8080
</ItemGroup>
8181
<ItemGroup>
82+
<Compile Include="AssemblyInfo.cs" />
8283
<Compile Include="Bug179.cs" />
8384
<Compile Include="Bug184.cs" />
8485
<Compile Include="Bug235.cs" />

net/DevExtreme.AspNet.Data.Tests.EF6/TestDbContext.cs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
namespace DevExtreme.AspNet.Data.Tests.EF6 {
99

1010
class TestDbContext : DbContext {
11-
static readonly object LOCK = new object();
1211
static TestDbContext INSTANCE;
1312

1413
private TestDbContext(string connectionString)
@@ -36,17 +35,15 @@ protected override void OnModelCreating(DbModelBuilder modelBuilder) {
3635
}
3736

3837
public static void Exec(Action<TestDbContext> action) {
39-
lock(LOCK) {
40-
if(INSTANCE == null) {
41-
var helper = new SqlServerTestDbHelper("EF6");
42-
helper.ResetDatabase();
38+
if(INSTANCE == null) {
39+
var helper = new SqlServerTestDbHelper("EF6");
40+
helper.ResetDatabase();
4341

44-
INSTANCE = new TestDbContext(helper.ConnectionString);
45-
INSTANCE.Database.CreateIfNotExists();
46-
}
47-
48-
action(INSTANCE);
42+
INSTANCE = new TestDbContext(helper.ConnectionString);
43+
INSTANCE.Database.CreateIfNotExists();
4944
}
45+
46+
action(INSTANCE);
5047
}
5148

5249
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
using Xunit;
2+
3+
[assembly: CollectionBehavior(DisableTestParallelization = true)]

net/DevExtreme.AspNet.Data.Tests.EFCore1/TestDbContext.cs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
namespace DevExtreme.AspNet.Data.Tests.EFCore1 {
66

77
class TestDbContext : DbContext {
8-
static readonly object LOCK = new object();
98
static TestDbContext INSTANCE;
109

1110
private TestDbContext(DbContextOptions options)
@@ -19,21 +18,19 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) {
1918
}
2019

2120
public static void Exec(Action<TestDbContext> action) {
22-
lock(LOCK) {
23-
if(INSTANCE == null) {
24-
var helper = new SqlServerTestDbHelper("EFCore1");
25-
helper.ResetDatabase();
21+
if(INSTANCE == null) {
22+
var helper = new SqlServerTestDbHelper("EFCore1");
23+
helper.ResetDatabase();
2624

27-
var options = new DbContextOptionsBuilder()
28-
.UseSqlServer(helper.ConnectionString)
29-
.Options;
25+
var options = new DbContextOptionsBuilder()
26+
.UseSqlServer(helper.ConnectionString)
27+
.Options;
3028

31-
INSTANCE = new TestDbContext(options);
32-
INSTANCE.Database.EnsureCreated();
33-
}
34-
35-
action(INSTANCE);
29+
INSTANCE = new TestDbContext(options);
30+
INSTANCE.Database.EnsureCreated();
3631
}
32+
33+
action(INSTANCE);
3734
}
3835

3936
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
using Xunit;
2+
3+
[assembly: CollectionBehavior(DisableTestParallelization = true)]

net/DevExtreme.AspNet.Data.Tests.EFCore2/TestDbContext.cs

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
namespace DevExtreme.AspNet.Data.Tests.EFCore2 {
77

88
class TestDbContext : DbContext {
9-
static readonly object LOCK = new object();
109
static TestDbContext INSTANCE;
1110

1211
private TestDbContext(DbContextOptions options)
@@ -22,22 +21,20 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) {
2221
}
2322

2423
public static void Exec(Action<TestDbContext> action) {
25-
lock(LOCK) {
26-
if(INSTANCE == null) {
27-
var helper = new SqlServerTestDbHelper("EFCore2");
28-
helper.ResetDatabase();
24+
if(INSTANCE == null) {
25+
var helper = new SqlServerTestDbHelper("EFCore2");
26+
helper.ResetDatabase();
2927

30-
var options = new DbContextOptionsBuilder()
31-
.UseSqlServer(helper.ConnectionString)
32-
.ConfigureWarnings(warnings => warnings.Throw(RelationalEventId.QueryClientEvaluationWarning))
33-
.Options;
28+
var options = new DbContextOptionsBuilder()
29+
.UseSqlServer(helper.ConnectionString)
30+
.ConfigureWarnings(warnings => warnings.Throw(RelationalEventId.QueryClientEvaluationWarning))
31+
.Options;
3432

35-
INSTANCE = new TestDbContext(options);
36-
INSTANCE.Database.EnsureCreated();
37-
}
38-
39-
action(INSTANCE);
33+
INSTANCE = new TestDbContext(options);
34+
INSTANCE.Database.EnsureCreated();
4035
}
36+
37+
action(INSTANCE);
4138
}
4239

4340
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
using Xunit;
2+
3+
[assembly: CollectionBehavior(DisableTestParallelization = true)]

net/DevExtreme.AspNet.Data.Tests.L2S/DevExtreme.AspNet.Data.Tests.L2S.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
<Folder Include="Properties\" />
8787
</ItemGroup>
8888
<ItemGroup>
89+
<Compile Include="AssemblyInfo.cs" />
8990
<Compile Include="RemoteGroupingStress.cs" />
9091
<Compile Include="Summary.cs" />
9192
<Compile Include="T670222_TotalSummary.cs" />

0 commit comments

Comments
 (0)