forked from nhibernate/nhibernate-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAddClassFixture.cs
43 lines (41 loc) · 996 Bytes
/
AddClassFixture.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using System;
using NHibernate.Cfg;
using NUnit.Framework;
namespace NHibernate.Test.MappingExceptions
{
/// <summary>
/// Summary description for AddClassFixture.
/// </summary>
[TestFixture]
public class AddClassFixture
{
[Test]
public void ClassMissingMappingFile()
{
Configuration cfg = new Configuration();
try
{
cfg.AddClass(typeof(A));
}
catch (MappingException me)
{
Assert.AreEqual("Resource not found: " + typeof(A).FullName + ".hbm.xml", me.Message);
}
}
[Test]
public void AddClassNotFound()
{
Configuration cfg = new Configuration();
try
{
cfg.AddResource("NHibernate.Test.MappingExceptions.A.ClassNotFound.hbm.xml", this.GetType().Assembly);
}
catch (MappingException me)
{
Assert.IsTrue(me.InnerException is MappingException);
MappingException innerMe = (MappingException) me.InnerException;
Assert.AreEqual("persistent class " + typeof(A).FullName + " not found", innerMe.Message);
}
}
}
}