Skip to content

Commit 38adef2

Browse files
committed
LazyFieldInterceptorTests: Rename existing test fixture and bring over the related NH3500 test case.
1 parent d6051cf commit 38adef2

File tree

3 files changed

+20
-40
lines changed

3 files changed

+20
-40
lines changed

src/NHibernate.Test/DynamicProxyTests/LazyFieldInterceptorSerializable.cs renamed to src/NHibernate.Test/DynamicProxyTests/LazyFieldInterceptorTests.cs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,18 @@
66

77
namespace NHibernate.Test.DynamicProxyTests
88
{
9-
public class LazyFieldInterceptorSerializable
9+
public class LazyFieldInterceptorTests
1010
{
1111
[Serializable]
1212
public class MyClass
1313
{
1414
public virtual int Id { get; set; }
15+
16+
public virtual void ThrowError()
17+
{
18+
// Use some specific exception type to avoid using the base class.
19+
throw new FormatException("test");
20+
}
1521
}
1622

1723
[Test]
@@ -31,5 +37,16 @@ public void LazyFieldInterceptorIsBinarySerializable()
3137

3238
Assert.That(fieldInterceptionProxy, Is.BinarySerializable);
3339
}
40+
41+
42+
[Test]
43+
public void DefaultDynamicLazyFieldInterceptorUnWrapsTIEExceptions()
44+
{
45+
var pf = new DefaultProxyFactory();
46+
var propertyInfo = typeof(MyClass).GetProperty("Id");
47+
pf.PostInstantiate("MyClass", typeof(MyClass), new HashSet<System.Type>(), propertyInfo.GetGetMethod(), propertyInfo.GetSetMethod(), null);
48+
var myClassProxied = (MyClass)pf.GetFieldInterceptionProxy(new MyClass());
49+
Assert.Throws<FormatException>(() => myClassProxied.ThrowError(), "test");
50+
}
3451
}
35-
}
52+
}

src/NHibernate.Test/NHSpecificTest/NH3500/Fixture.cs

Lines changed: 0 additions & 36 deletions
This file was deleted.

src/NHibernate.Test/NHibernate.Test.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@
258258
<Compile Include="DynamicProxyTests\InterfaceProxySerializationTests\MyProxyImpl.cs" />
259259
<Compile Include="DynamicProxyTests\InterfaceProxySerializationTests\ProxyFixture.cs" />
260260
<Compile Include="DynamicProxyTests\InterfaceWithEqualsGethashcodeTests.cs" />
261-
<Compile Include="DynamicProxyTests\LazyFieldInterceptorSerializable.cs" />
261+
<Compile Include="DynamicProxyTests\LazyFieldInterceptorTests.cs" />
262262
<Compile Include="DynamicProxyTests\PassThroughInterceptor.cs" />
263263
<Compile Include="DynamicProxyTests\PeVerifier.cs" />
264264
<Compile Include="DynamicProxyTests\ProxiedMembers\Fixture.cs" />
@@ -731,7 +731,6 @@
731731
<Compile Include="NHSpecificTest\NH2931\Models.cs" />
732732
<Compile Include="NHSpecificTest\NH3046\Fixture.cs" />
733733
<Compile Include="NHSpecificTest\NH3046\Model.cs" />
734-
<Compile Include="NHSpecificTest\NH3500\Fixture.cs" />
735734
<Compile Include="NHSpecificTest\NH3518\ClassWithXmlMember.cs" />
736735
<Compile Include="NHSpecificTest\NH3518\XmlColumnTest.cs" />
737736
<Compile Include="NHSpecificTest\NH3609\MappingEntity.cs" />

0 commit comments

Comments
 (0)