1 // Copyright 2004-2008 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 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
;
23 public class GenericJoinedSubClassTestCase
: AbstractActiveRecordTest
26 public void Entities()
28 ActiveRecordStarter
.Initialize( GetConfigSource(),
29 typeof(Model
.GenericModel
.Entity
<>),
30 typeof(CompanyEntity
),
31 typeof(PersonEntity
));
34 CompanyEntity
.DeleteAll();
35 PersonEntity
.DeleteAll();
37 CompanyEntity ce
= new CompanyEntity();
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
);