Skip to content

Commit 34d661b

Browse files
committed
TagTest : Separate session per test
this prevents some errors Additonal change is CreateSessionAndTransaction returns session and scope of transaction, it is useful for opening global session and transaction as well as for opening session and transaction per test.
1 parent 1454097 commit 34d661b

14 files changed

+133
-123
lines changed

Orm/Xtensive.Orm.Tests.Framework/AutoBuildTest.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// Copyright (C) 2003-2010 Xtensive LLC.
2-
// All rights reserved.
3-
// For conditions of distribution and use, see license.
1+
// Copyright (C) 2008-2023 Xtensive LLC.
2+
// This code is distributed under MIT license terms.
3+
// See the License.txt file in the project root for more information.
44
// Created by: Dmitri Maximov
55
// Created: 2008.07.31
66

@@ -72,14 +72,15 @@ protected virtual void CheckRequirements()
7272
{
7373
}
7474

75-
protected void CreateSessionAndTransaction()
75+
protected (Session, TransactionScope) CreateSessionAndTransaction()
7676
{
7777
try {
7878
disposables = new DisposableSet();
7979
var session = Domain.OpenSession();
80-
disposables.Add(session);
8180
var transaction = session.OpenTransaction();
82-
disposables.Add(transaction);
81+
_ = disposables.Add(session);
82+
_ = disposables.Add(transaction);
83+
return (session, transaction);
8384
}
8485
catch {
8586
disposables.DisposeSafely();

Orm/Xtensive.Orm.Tests/Issues/Issue0435_BatchingFail.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (C) 2009-2020 Xtensive LLC.
1+
// Copyright (C) 2009-20223 Xtensive LLC.
22
// This code is distributed under MIT license terms.
33
// See the License.txt file in the project root for more information.
44
// Created by: Denis Krjuchkov
@@ -38,7 +38,7 @@ protected override DomainConfiguration BuildConfiguration()
3838
public override void TestFixtureSetUp()
3939
{
4040
base.TestFixtureSetUp();
41-
CreateSessionAndTransaction();
41+
_ = CreateSessionAndTransaction();
4242
}
4343

4444
[Test]

Orm/Xtensive.Orm.Tests/Issues/IssueJira0187_TypeCastInContain.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// Copyright (C) 2011 Xtensive LLC.
2-
// All rights reserved.
3-
// For conditions of distribution and use, see license.
1+
// Copyright (C) 2011-2023 Xtensive LLC.
2+
// This code is distributed under MIT license terms.
3+
// See the License.txt file in the project root for more information.
44
// Created by: Dmitri Maximov
55
// Created: 2011.09.06
66

@@ -53,7 +53,7 @@ protected override DomainConfiguration BuildConfiguration()
5353
public override void TestFixtureSetUp()
5454
{
5555
base.TestFixtureSetUp();
56-
CreateSessionAndTransaction();
56+
_ = CreateSessionAndTransaction();
5757
}
5858

5959
[Test]

Orm/Xtensive.Orm.Tests/Issues/IssueJira0221_UnableToTranslateAggregate.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (C) 2011-2021 Xtensive LLC.
1+
// Copyright (C) 2011-2023 Xtensive LLC.
22
// This code is distributed under MIT license terms.
33
// See the License.txt file in the project root for more information.
44
// Created by: Denis Krjuchkov
@@ -54,7 +54,7 @@ public override void TestFixtureSetUp()
5454
{
5555
base.TestFixtureSetUp();
5656

57-
CreateSessionAndTransaction();
57+
_ = CreateSessionAndTransaction();
5858

5959
_ = new ZamesInfo {Owner = new Zames(), Rank = 1};
6060
_ = new ZamesInfo {Owner = new Zames(), Rank = 3};

Orm/Xtensive.Orm.Tests/Issues/IssueJira0242_LegacyExecuteMethodsDoNotWork.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (C) 2012-2020 Xtensive LLC.
1+
// Copyright (C) 2012-2023 Xtensive LLC.
22
// This code is distributed under MIT license terms.
33
// See the License.txt file in the project root for more information.
44
// Created by: Denis Krjuchkov
@@ -16,7 +16,7 @@ public class IssueJira0242_LegacyExecuteMethodsDoNotWork : AutoBuildTest
1616
public override void TestFixtureSetUp()
1717
{
1818
base.TestFixtureSetUp();
19-
CreateSessionAndTransaction();
19+
_ = CreateSessionAndTransaction();
2020
}
2121

2222
#region Compiled queries

Orm/Xtensive.Orm.Tests/Issues/IssueJira0746_LikeBehaviorDifferentOnClientSide.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (C) 2018-2020 Xtensive LLC.
1+
// Copyright (C) 2018-2023 Xtensive LLC.
22
// This code is distributed under MIT license terms.
33
// See the License.txt file in the project root for more information.
44
// Created by: Denis Kudelin
@@ -87,7 +87,7 @@ public class IssueJira0746_LikeBehaviorDifferentOnClientSide : AutoBuildTest
8787
public override void TestFixtureSetUp()
8888
{
8989
base.TestFixtureSetUp();
90-
CreateSessionAndTransaction();
90+
_ = CreateSessionAndTransaction();
9191
}
9292

9393
protected override DomainConfiguration BuildConfiguration()

Orm/Xtensive.Orm.Tests/Linq/ConvariantQueriesTest.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// Copyright (C) 2011 Xtensive LLC.
2-
// All rights reserved.
3-
// For conditions of distribution and use, see license.
1+
// Copyright (C) 2011-2023 Xtensive LLC.
2+
// This code is distributed under MIT license terms.
3+
// See the License.txt file in the project root for more information.
44
// Created by: Denis Krjuchkov
55
// Created: 2011.11.02
66

@@ -42,7 +42,7 @@ protected override DomainConfiguration BuildConfiguration()
4242
public override void TestFixtureSetUp()
4343
{
4444
base.TestFixtureSetUp();
45-
CreateSessionAndTransaction();
45+
_ = CreateSessionAndTransaction();
4646
}
4747

4848
[Test]

0 commit comments

Comments
 (0)