Fixing an issue where setting a custom property on a handler will not propagate it...
[castle.git] / ActiveRecord / Castle.ActiveRecord.Tests / GenericJoinedSubClassTestCase.cs
blob267bd8e81c047e4723cea594ac1a86890bede131
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 Castle.ActiveRecord.Tests.Model;
18 using NUnit.Framework;
19 using CompanyEntity=Castle.ActiveRecord.Tests.Model.GenericModel.CompanyEntity;
20 using PersonEntity=Castle.ActiveRecord.Tests.Model.GenericModel.PersonEntity;
22 [TestFixture]
23 public class GenericJoinedSubClassTestCase : AbstractActiveRecordTest
25 [Test]
26 public void Entities()
28 ActiveRecordStarter.Initialize( GetConfigSource(),
29 typeof(Model.GenericModel.Entity<>),
30 typeof(CompanyEntity),
31 typeof(PersonEntity));
32 Recreate();
34 CompanyEntity.DeleteAll();
35 PersonEntity.DeleteAll();
37 CompanyEntity ce = new CompanyEntity();
38 ce.Name = "Keldor";
39 ce.CompanyType = 1;
40 ce.Save();
42 CompanyEntity[] ces = CompanyEntity.FindAll();
43 Assert.AreEqual( 1, ces.Length );
45 PersonEntity[] pes = PersonEntity.FindAll();
46 Assert.AreEqual( 0, pes.Length );
48 Assert.AreEqual( ce.CompId, ces[0].CompId );
49 Assert.AreEqual( ce.Name, ces[0].Name );
50 Assert.AreEqual( ce.Id, ces[0].Id );