forked from nhibernate/nhibernate-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMultipleBagFetchFixture.cs
52 lines (47 loc) · 1.2 KB
/
MultipleBagFetchFixture.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
44
45
46
47
48
49
50
51
52
using System;
using System.Collections;
using System.Collections.Generic;
using NUnit.Framework;
namespace NHibernate.Test.MultipleCollectionFetchTest
{
[TestFixture]
public class MultipleBagFetchFixture : AbstractMultipleCollectionFetchFixture
{
protected override string[] Mappings
{
get { return new string[] {"MultipleCollectionFetchTest.PersonBag.hbm.xml"}; }
}
protected override void AddToCollection(ICollection<Person> collection, Person person)
{
((List<Person>) collection).Add(person);
}
protected override ICollection<Person> CreateCollection()
{
return new List<Person>();
}
protected override void RunLinearJoinFetchTest(Person parent)
{
try
{
base.RunLinearJoinFetchTest(parent);
Assert.Fail("Should have failed");
}
catch (QueryException e)
{
Assert.IsTrue(e.Message.IndexOf("Cannot simultaneously fetch multiple bags") >= 0);
}
}
protected override void RunNonLinearJoinFetchTest(Person person)
{
try
{
base.RunNonLinearJoinFetchTest(person);
Assert.Fail("Should have failed");
}
catch (QueryException e)
{
Assert.IsTrue(e.Message.IndexOf("Cannot simultaneously fetch multiple bags") >= 0);
}
}
}
}