Skip to content

Commit fcc3076

Browse files
darrenkopphazzik
authored andcommitted
add tests
Add tests. Had to use old hbm.xml method since length gets ignored on new by code stuff
1 parent a05a35e commit fcc3076

File tree

4 files changed

+82
-0
lines changed

4 files changed

+82
-0
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
using System;
2+
using System.Collections;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Text;
6+
using NUnit.Framework;
7+
using NHibernate.Linq;
8+
9+
namespace NHibernate.Test.NHSpecificTest.NH3252
10+
{
11+
[TestFixture]
12+
public class Fixture : TestCase
13+
{
14+
protected override string MappingsAssembly
15+
{
16+
get { return "NHibernate.Test"; }
17+
}
18+
19+
protected override IList Mappings
20+
{
21+
get { return new string[] { "NHSpecificTest.NH3252.Mappings.hbm.xml" }; }
22+
}
23+
24+
[Test]
25+
public void VerifyThatWeCanSaveAndLoad()
26+
{
27+
using (ISession session = OpenSession())
28+
using (ITransaction transaction = session.BeginTransaction())
29+
{
30+
31+
session.Save(new Note { Text = new String('0', 9000) });
32+
transaction.Commit();
33+
}
34+
35+
using (ISession session = OpenSession())
36+
using (ITransaction transaction = session.BeginTransaction())
37+
{
38+
39+
var note = session.Query<Note>().First();
40+
Assert.AreEqual(9000, note.Text.Length);
41+
}
42+
}
43+
44+
protected override void OnTearDown()
45+
{
46+
using (ISession session = OpenSession())
47+
using (ITransaction transaction = session.BeginTransaction())
48+
{
49+
session.Delete("from System.Object");
50+
51+
session.Flush();
52+
transaction.Commit();
53+
}
54+
}
55+
}
56+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="NHibernate.Test.NHSpecificTest.NH3252" assembly="NHibernate.Test">
3+
<class name="Note">
4+
<id name="Id" type="Int32">
5+
<generator class="identity" />
6+
</id>
7+
<property name="Text" type="AnsiString" length="10000" />
8+
</class>
9+
</hibernate-mapping>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
6+
namespace NHibernate.Test.NHSpecificTest.NH3252
7+
{
8+
class Note
9+
{
10+
public virtual int Id { get; protected set; }
11+
12+
public virtual string Text { get; set; }
13+
}
14+
}

src/NHibernate.Test/NHibernate.Test.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -801,6 +801,8 @@
801801
<Compile Include="NHSpecificTest\NH3428\Fixture.cs" />
802802
<Compile Include="NHSpecificTest\NH3316\ByCodeFixture.cs" />
803803
<Compile Include="NHSpecificTest\NH3316\Entity.cs" />
804+
<Compile Include="NHSpecificTest\NH3252\Fixture.cs" />
805+
<Compile Include="NHSpecificTest\NH3252\Note.cs" />
804806
<Compile Include="NHSpecificTest\NH3408\Fixture.cs" />
805807
<Compile Include="NHSpecificTest\NH3408\Model.cs" />
806808
<Compile Include="NHSpecificTest\NH2297\CustomCompositeUserType.cs" />
@@ -3163,6 +3165,7 @@
31633165
<EmbeddedResource Include="NHSpecificTest\NH3505\Mappings.hbm.xml" />
31643166
<EmbeddedResource Include="NHSpecificTest\NH3428\Mappings.hbm.xml" />
31653167
<EmbeddedResource Include="NHSpecificTest\NH3641\Mappings.hbm.xml" />
3168+
<EmbeddedResource Include="NHSpecificTest\NH3252\Mappings.hbm.xml" />
31663169
<EmbeddedResource Include="NHSpecificTest\NH3408\Mappings.hbm.xml" />
31673170
<EmbeddedResource Include="NHSpecificTest\NH2408\Mappings.hbm.xml" />
31683171
<EmbeddedResource Include="NHSpecificTest\NH2297\MappingsNames.hbm.xml" />

0 commit comments

Comments
 (0)