Skip to content

failing test for NH-3074 #87

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions src/NHibernate.Test/NHSpecificTest/NH3074/Fixture.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using NUnit.Framework;
using SharpTestsEx;

namespace NHibernate.Test.NHSpecificTest.NH3074
{
[TestFixture]
public class Fixture : BugTestCase
{
private const int id =123;

protected override void OnSetUp()
{
using (var s = OpenSession())
{
using (var tx = s.BeginTransaction())
{
var cat = new Cat {Id = id, NumberOfLegs = 2, Weight = 100};
s.Save(cat);
tx.Commit();
}
}
}

[Test]
public void CanSetLockMode()
{
using (var s = OpenSession())
{
using (s.BeginTransaction())
{
s.CreateQuery("select c from Animal c where c.Id=:id")
.SetInt32("id", id)
.SetLockMode("c", LockMode.Upgrade)
.List<Cat>()
.Should().Not.Be.Empty();
}
}
}

protected override void OnTearDown()
{
using (var s = OpenSession())
{
using (var tx = s.BeginTransaction())
{
s.Delete(s.Get<Cat>(id));
tx.Commit();
}
}
}
}
}
16 changes: 16 additions & 0 deletions src/NHibernate.Test/NHSpecificTest/NH3074/Mappings.hbm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
assembly="NHibernate.Test"
namespace="NHibernate.Test.NHSpecificTest.NH3074">

<class name="Animal">
<id name="Id">
<generator class="assigned" />
</id>
<property name="Weight" />

<union-subclass name="Cat">
<property name="NumberOfLegs" />
</union-subclass>
</class>
</hibernate-mapping>
13 changes: 13 additions & 0 deletions src/NHibernate.Test/NHSpecificTest/NH3074/Model.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace NHibernate.Test.NHSpecificTest.NH3074
{
public class Animal
{
public virtual int Id { get; set; }
public virtual int Weight { get; set; }
}

public class Cat :Animal
{
public virtual int NumberOfLegs { get; set; }
}
}
3 changes: 3 additions & 0 deletions src/NHibernate.Test/NHibernate.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,8 @@
<Compile Include="NHSpecificTest\NH2869\MyLinqExtensions.cs" />
<Compile Include="NHSpecificTest\NH2869\MyLinqToHqlGeneratorsRegistry.cs" />
<Compile Include="NHSpecificTest\NH2893\Fixture.cs" />
<Compile Include="NHSpecificTest\NH3074\Fixture.cs" />
<Compile Include="NHSpecificTest\NH3074\Model.cs" />
<Compile Include="NHSpecificTest\NH941\Domain.cs" />
<Compile Include="NHSpecificTest\NH941\Fixture.cs" />
<Compile Include="NHSpecificTest\NH941\FixtureUsingList.cs" />
Expand Down Expand Up @@ -2748,6 +2750,7 @@
<EmbeddedResource Include="NHSpecificTest\NH1291AnonExample\Mappings.hbm.xml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="NHSpecificTest\NH3074\Mappings.hbm.xml" />
<EmbeddedResource Include="NHSpecificTest\NH2869\Mappings.hbm.xml" />
<EmbeddedResource Include="NHSpecificTest\NH0000\Mappings.hbm.xml" />
<EmbeddedResource Include="NHSpecificTest\NH2828\Mappings.hbm.xml" />
Expand Down