1 // Copyright 2004-2007 Castle Project - http://www.castleproject.org/
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle
.ActiveRecord
.Tests
17 using System
.Collections
;
18 using System
.Collections
.Generic
;
19 using NUnit
.Framework
;
22 public class BugTestCase
: AbstractActiveRecordTest
25 public void SemanticVisitorBug()
27 ActiveRecordStarter
.Initialize(GetConfigSource(),
28 typeof(Bank
), typeof(Customer
), typeof(Card
));
34 public void AR170Test()
36 ActiveRecordStarter
.Initialize(GetConfigSource(),
37 typeof(HierarchyItem
), typeof(Folder
), typeof(FolderBase
));
43 public void InheritanceBug()
45 ActiveRecordStarter
.Initialize(GetConfigSource(),
46 typeof(Parent
), typeof(Child
), typeof(GrandChild
));
50 #region SemanticVisitorBug related
53 public class Bank
: ActiveRecordBase
56 private IList customers
;
73 [HasMany(typeof(Customer
))]
74 public IList Customers
76 get { return customers; }
77 set { customers = value; }
82 public class Customer
: ActiveRecordBase
102 [HasMany(typeof(Card
))]
105 get { return cards; }
106 set { cards = value; }
111 public class Card
: ActiveRecordBase
114 private Customer customer
;
124 public Customer Customer
126 get { return customer; }
127 set { customer = value; }
133 #region InheritanceBug related
135 public class Parent
: ActiveRecordBase
147 public class Child
: Parent
152 public class GrandChild
: Child
160 [ActiveRecord("HierarchyItems",
161 DiscriminatorColumn
= "Type",
162 DiscriminatorType
= "String",
163 DiscriminatorValue
= "HierarchyItem")]
164 public class HierarchyItem
: ActiveRecordBase
167 private Folder _parent
;
179 get { return _parent; }
180 set { _parent = value; }
184 [ActiveRecord("FolderBases",
185 DiscriminatorValue
= "FolderBase")]
186 public abstract class FolderBase
: HierarchyItem
188 public abstract IList
<HierarchyItem
> Children { get; }
191 [ActiveRecord("PhysicalFolders",
192 DiscriminatorValue
= "PhysicalFolder")]
193 public class Folder
: FolderBase
195 private IList
<HierarchyItem
> children
= new List
<HierarchyItem
>();
197 [HasMany(Access
= PropertyAccess
.FieldCamelcase
)]
198 public override IList
<HierarchyItem
> Children
200 get { return children; }