Permalink
Browse files

Added failing tests for NH-3132

  • Loading branch information...
1 parent c99b10c commit 2c4bc3e18e602786646ce3d025edde86e7600190 @Nicaog Nicaog committed May 1, 2012
@@ -0,0 +1,84 @@
+using System.Collections;
+using NHibernate.Criterion;
+using NUnit.Framework;
+
+namespace NHibernate.Test.NHSpecificTest.NH3132
+{
+ [TestFixture]
+ public class Fixture : TestCase
+ {
+ protected override string MappingsAssembly
+ {
+ get { return "NHibernate.Test"; }
+ }
+
+ protected override IList Mappings
+ {
+ get
+ {
+ return new string[]
+ {
+ "NHSpecificTest.NH3132.Mappings.hbm.xml"
+ };
+ }
+ }
+
+ /// <summary>
+ /// push some data into the database
+ /// Really functions as a save test also
+ /// </summary>
+ protected override void OnSetUp()
+ {
+ base.OnSetUp();
+
+ using (var session = OpenSession())
+ {
+ using (var tran = session.BeginTransaction())
+ {
+ Product product = new Product();
+ product.Name = "First";
+ product.Lazy = "Lazy";
+
+ session.Save(product);
+
+/* Inventory inventory = new Inventory();
+ inventory.Id = product.Id;
+ inventory.Quantity = 1;
+
+ session.Save(inventory);*/
+
+ tran.Commit();
+ }
+ }
+ }
+
+ protected override void OnTearDown()
+ {
+ base.OnTearDown();
+
+ using (var session = OpenSession())
+ {
+ using (var tran = session.BeginTransaction())
+ {
+ session.Delete("from Product");
+ tran.Commit();
+ }
+ }
+
+ }
+
+ [Test]
+ public void Query_returns_correct_name()
+ {
+ using (var session = OpenSession())
+ {
+ Product product = session.CreateCriteria(typeof (Product))
+ .Add(Restrictions.Eq("Name", "First"))
+ .UniqueResult<Product>();
+
+ Assert.IsNotNull(product);
+ Assert.AreEqual("First", product.Name);
+ }
+ }
+ }
+}
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="NHibernate.Test"
+ namespace="NHibernate.Test.NHSpecificTest.NH3132">
+ <class name="Product" table="Products">
+ <id name="Id" type="Guid">
+ <generator class="guid" />
+ </id>
+ <property name="Name" access="field.camelcase-underscore"/>
+ <property name="Lazy" lazy="true"/>
+ </class>
+</hibernate-mapping>
@@ -0,0 +1,18 @@
+using System;
+
+namespace NHibernate.Test.NHSpecificTest.NH3132
+{
+ public class Product
+ {
+ public virtual Guid Id { get; set; }
+
+ private string _name;
+ public virtual string Name
+ {
+ get { return _name; }
+ set { _name = value; }
+ }
+
+ public virtual string Lazy { get; set; }
+ }
+}
@@ -967,6 +967,8 @@
<Compile Include="NHSpecificTest\NH941\FixtureUsingList.cs" />
<Compile Include="NHSpecificTest\NH3016\Entity.cs" />
<Compile Include="NHSpecificTest\NH3016\Fixture.cs" />
+ <Compile Include="NHSpecificTest\NH3132\Fixture.cs" />
+ <Compile Include="NHSpecificTest\NH3132\Product.cs" />
<Compile Include="NHSpecificTest\Properties\CompositePropertyRefTest.cs" />
<Compile Include="NHSpecificTest\Properties\DynamicEntityTest.cs" />
<Compile Include="NHSpecificTest\Properties\Model.cs" />
@@ -2815,6 +2817,7 @@
<EmbeddedResource Include="NHSpecificTest\NH1291AnonExample\Mappings.hbm.xml" />
</ItemGroup>
<ItemGroup>
+ <EmbeddedResource Include="NHSpecificTest\NH3132\Mappings.hbm.xml" />
<EmbeddedResource Include="NHSpecificTest\NH2664\Mappings.hbm.xml" />
<EmbeddedResource Include="NHSpecificTest\NH2214\Mappings.hbm.xml" />
<EmbeddedResource Include="NHSpecificTest\NH2960\Mappings.hbm.xml" />

0 comments on commit 2c4bc3e

Please sign in to comment.