📄 fixture.cs
字号:
using System;
using System.Collections;
using NUnit.Framework;
namespace NHibernate.Test.NHSpecificTest.Docs.Associations.BiM21
{
[TestFixture]
public class Fixture : TestCase
{
protected override string MappingsAssembly
{
get { return "NHibernate.Test"; }
}
protected override IList Mappings
{
get { return new string[] {"NHSpecificTest.Docs.Associations.BiM21.Mappings.hbm.xml"}; }
}
[Test]
public void TestCorrectUse()
{
ISession session = OpenSession();
Person fred = new Person();
Person wilma = new Person();
Address flinstoneWay = new Address();
fred.Address = flinstoneWay;
wilma.Address = flinstoneWay;
session.Save(flinstoneWay);
session.Save(fred);
session.Save(wilma);
session.Close();
// clean up
session = OpenSession();
session.Delete("from Person");
session.Delete("from Address");
session.Flush();
session.Close();
}
[Test]
[ExpectedException(typeof(PropertyValueException))]
public void TestErrorUsage()
{
using (ISession session = OpenSession())
{
Person fred = new Person();
Person wilma = new Person();
Address flinstoneWay = new Address();
fred.Address = flinstoneWay;
wilma.Address = flinstoneWay;
session.Save(fred);
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -