Skip to content

Commit 94a6020

Browse files
committed
AutoBuildTest: Fixed error message on attempt to access uninitialized global session
1 parent d1ac731 commit 94a6020

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ namespace Xtensive.Orm.Tests
1818
public abstract class AutoBuildTest : HasConfigurationAccessTest
1919
{
2020
private const string ErrorInTestFixtureSetup = "Error in TestFixtureSetUp:\r\n{0}";
21+
private const string ErrorNotInitializedGlobalSession = "Set InitGlobalSession to true";
22+
2123
private DisposableSet disposables;
2224
private (Session session, TransactionScope transaction) globalSessionAndTransaction;
2325

@@ -33,8 +35,8 @@ public abstract class AutoBuildTest : HasConfigurationAccessTest
3335
// Use these two for read-only tests only, don't change them, they are controlled by AutoBuildTest.
3436
// If there is need to change Session/Transactionscope or add/modify/remove entities
3537
// then open dedicated Session/TransactionScope within test
36-
protected Session GlobalSession => InitGlobalSession ? globalSessionAndTransaction.session : throw new Exception("Set UseGlobalSession to true");
37-
protected TransactionScope GlobalTransaction => InitGlobalSession ? globalSessionAndTransaction.transaction : throw new Exception("Set UseGlobalSession to true");
38+
protected Session GlobalSession => InitGlobalSession ? globalSessionAndTransaction.session : throw new Exception(ErrorNotInitializedGlobalSession);
39+
protected TransactionScope GlobalTransaction => InitGlobalSession ? globalSessionAndTransaction.transaction : throw new Exception(ErrorNotInitializedGlobalSession);
3840

3941
[OneTimeSetUp]
4042
public virtual void TestFixtureSetUp()

0 commit comments

Comments
 (0)