Changed to use Authenticate asp.net event instead of Authorize
[castle.git] / ActiveRecord / Castle.ActiveRecord.Tests / BugTestCase.cs
blob374f5cb47b0a4eaf4437bb1a0247ec5ee104ea97
1 // Copyright 2004-2007 Castle Project - http://www.castleproject.org/
2 //
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
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
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;
21 [TestFixture]
22 public class BugTestCase : AbstractActiveRecordTest
24 [Test]
25 public void SemanticVisitorBug()
27 ActiveRecordStarter.Initialize(GetConfigSource(),
28 typeof(Bank), typeof(Customer), typeof(Card));
30 Recreate();
33 [Test]
34 public void AR170Test()
36 ActiveRecordStarter.Initialize(GetConfigSource(),
37 typeof(HierarchyItem), typeof(Folder), typeof(FolderBase));
39 Recreate();
42 [Test]
43 public void InheritanceBug()
45 ActiveRecordStarter.Initialize(GetConfigSource(),
46 typeof(Parent), typeof(Child), typeof(GrandChild));
50 #region SemanticVisitorBug related
52 [ActiveRecord]
53 public class Bank : ActiveRecordBase
55 private int id;
56 private IList customers;
57 private Card card;
59 [PrimaryKey]
60 public int Id
62 get { return id; }
63 set { id = value; }
66 [BelongsTo]
67 public Card Card
69 get { return card; }
70 set { card = value; }
73 [HasMany(typeof(Customer))]
74 public IList Customers
76 get { return customers; }
77 set { customers = value; }
81 [ActiveRecord]
82 public class Customer : ActiveRecordBase
84 private int id;
85 private IList cards;
86 private Bank bank;
88 [PrimaryKey]
89 public int Id
91 get { return id; }
92 set { id = value; }
95 [BelongsTo]
96 public Bank Bank
98 get { return bank; }
99 set { bank = value; }
102 [HasMany(typeof(Card))]
103 public IList Cards
105 get { return cards; }
106 set { cards = value; }
110 [ActiveRecord]
111 public class Card : ActiveRecordBase
113 private int id;
114 private Customer customer;
116 [PrimaryKey]
117 public int Id
119 get { return id; }
120 set { id = value; }
123 [BelongsTo]
124 public Customer Customer
126 get { return customer; }
127 set { customer = value; }
131 #endregion
133 #region InheritanceBug related
135 public class Parent : ActiveRecordBase
137 private int id;
139 [PrimaryKey]
140 public int Id
142 get { return id; }
143 set { id = value; }
147 public class Child : Parent
151 [ActiveRecord]
152 public class GrandChild : Child
156 #endregion
158 #region AR-170
160 [ActiveRecord("HierarchyItems",
161 DiscriminatorColumn = "Type",
162 DiscriminatorType = "String",
163 DiscriminatorValue = "HierarchyItem")]
164 public class HierarchyItem : ActiveRecordBase
166 private int _id;
167 private Folder _parent;
169 [PrimaryKey]
170 public int Id
172 get { return _id; }
173 set { _id = value; }
176 [BelongsTo]
177 public 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; }
204 #endregion