Skip to content

Commit 6230207

Browse files
committed
NH-3807 - Test project
Distributed transactions not supported in .netstandard. Enlisted transactions are still supported, as long as they are single-phase with the durable resource.
1 parent 9f51dba commit 6230207

40 files changed

+326
-4155
lines changed

src/NHibernate.Test/App.config

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@
102102
<runtime>
103103
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
104104
<dependentAssembly>
105-
<assemblyIdentity name="nunit.framework" publicKeyToken="96d09a1eb7f44a77" culture="neutral"/>
106-
<bindingRedirect oldVersion="0.0.0.0-2.6.1.12217" newVersion="2.6.1.12217"/>
105+
<assemblyIdentity name="nunit.framework" publicKeyToken="96d09a1eb7f44a77" culture="neutral" />
106+
<bindingRedirect oldVersion="0.0.0.0-3.6.1.0" newVersion="3.6.1.0" />
107107
</dependentAssembly>
108108
</assemblyBinding>
109109
</runtime>

src/NHibernate.Test/CrossThreadTestRunner.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ private void Run()
5757
}
5858
}
5959

60+
#if !NETCOREAPP2_0
6061
[ReflectionPermission(SecurityAction.Demand)]
62+
#endif
6163
private static void ThrowExceptionPreservingStack(Exception exception)
6264
{
6365
if (RemoteStackTraceField != null)

src/NHibernate.Test/DriverTest/DbProviderFactoryDriveConnectionCommandProviderTest.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#if !NETCOREAPP2_0
12
using System;
23
using System.Data.Common;
34
using NHibernate.Driver;
@@ -35,4 +36,5 @@ public void WhenCreatedWithDbFactoryThenCanReturnCommand()
3536
}
3637
}
3738
}
38-
}
39+
}
40+
#endif

src/NHibernate.Test/DriverTest/OracleClientDriverFixture.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#if !NETCOREAPP2_0
12
using System;
23
using System.Data.Common;
34
using NHibernate.Driver;
@@ -35,4 +36,5 @@ public void CommandClassName()
3536
Assert.AreEqual("System.Data.OracleClient.OracleCommand", cmd.GetType().FullName);
3637
}
3738
}
38-
}
39+
}
40+
#endif

src/NHibernate.Test/DriverTest/OracleDataClientDriverFixture.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#if !NETCOREAPP2_0
12
using System;
23
using System.Data;
34
using System.Data.Common;
@@ -34,4 +35,5 @@ public void NoBooleanParameters()
3435
Assert.IsFalse(param.DbType == DbType.Boolean, "should not still be a DbType.Boolean");
3536
}
3637
}
37-
}
38+
}
39+
#endif

src/NHibernate.Test/DriverTest/ReflectionBasedDriverTest.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#if !NETCOREAPP2_0
12
using System;
23
using NHibernate.Driver;
34
using NUnit.Framework;
@@ -114,4 +115,5 @@ public void WhenCreatedNoWithDbFactoryThenCanReturnCommand()
114115
}
115116
}
116117
}
117-
}
118+
}
119+
#endif

src/NHibernate.Test/DynamicProxyTests/LazyFieldInterceptorTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public void LazyFieldInterceptorIsBinarySerializable()
3535
var fieldInterceptionProxy = (IFieldInterceptorAccessor)pf.GetFieldInterceptionProxy(new MyClass());
3636
fieldInterceptionProxy.FieldInterceptor = new DefaultFieldInterceptor(null, null, null, "MyClass", typeof(MyClass));
3737

38-
Assert.That(fieldInterceptionProxy, Is.BinarySerializable);
38+
NHAssert.IsSerializable(fieldInterceptionProxy);
3939
}
4040

4141

src/NHibernate.Test/ExceptionsTest/OracleClientExceptionConverterExample.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#if !NETCOREAPP2_0
12
using System;
23
using System.Data.OracleClient;
34
using NHibernate.Exceptions;
@@ -27,4 +28,5 @@ public Exception Convert(AdoExceptionContextInfo exInfo)
2728

2829
#endregion
2930
}
30-
}
31+
}
32+
#endif

src/NHibernate.Test/ExceptionsTest/SQLExceptionConversionTest.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ protected override bool AppliesTo(Dialect.Dialect dialect)
3232
protected override bool AppliesTo(ISessionFactoryImplementor factory)
3333
{
3434
var driver = factory.ConnectionProvider.Driver;
35-
return !(driver is OracleDataClientDriver) && !(driver is OracleManagedDataAccessDriver) && !(driver is OracleLiteDataClientDriver) && !(driver is OdbcDriver) && !(driver is OleDbDriver);
35+
return !(driver.IsOracleDataClientDriver()) && !(driver.IsOracleManagedDataAccessDriver()) && !(driver.IsOracleLiteDataClientDriver()) && !(driver.IsOdbcDriver()) && !(driver.IsOleDbDriver());
3636
}
3737

3838
protected override void Configure(Cfg.Configuration configuration)
@@ -44,6 +44,7 @@ protected override void Configure(Cfg.Configuration configuration)
4444
typeof(MSSQLExceptionConverterExample).AssemblyQualifiedName);
4545
}
4646

47+
#if !NETCOREAPP2_0
4748
if (Dialect is Oracle8iDialect)
4849
{
4950
configuration.SetProperty(
@@ -57,8 +58,9 @@ protected override void Configure(Cfg.Configuration configuration)
5758
Cfg.Environment.SqlExceptionConverter,
5859
typeof(PostgresExceptionConverterExample).AssemblyQualifiedName);
5960
}
61+
#endif
6062

61-
if (Dialect is FirebirdDialect)
63+
if (Dialect is FirebirdDialect)
6264
{
6365
configuration.SetProperty(
6466
Cfg.Environment.SqlExceptionConverter,

src/NHibernate.Test/Hql/Ast/LimitClauseFixture.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ public class LimitClauseFixture : BaseFixture
1010
{
1111
protected override bool AppliesTo(Dialect.Dialect dialect)
1212
{
13+
#if NETCOREAPP2_0
14+
return dialect.SupportsVariableLimit;
15+
#else
1316
return dialect.SupportsVariableLimit
1417
&& !(Dialect is Dialect.MsSql2000Dialect && cfg.Properties[Environment.ConnectionDriver] == typeof(Driver.OdbcDriver).FullName); // don't know why, but these tests don't work on SQL Server using ODBC
18+
#endif
1519
}
1620

1721
protected override void OnSetUp()
@@ -175,4 +179,4 @@ public void TakeWithParameter()
175179
s.Close();
176180
}
177181
}
178-
}
182+
}

0 commit comments

Comments
 (0)