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
19 using NUnit
.Framework
;
22 public class MultipleDatabasesTestCase
: AbstractActiveRecordTest
29 ActiveRecordStarter
.Initialize(GetConfigSource(),
30 typeof(Blog
), typeof(Post
), typeof(Hand
), typeof(Test2ARBase
));
36 public void OperateOne()
38 Blog
[] blogs
= Blog
.FindAll();
40 Assert
.AreEqual(0, blogs
.Length
);
44 blogs
= Blog
.FindAll();
45 Assert
.AreEqual(1, blogs
.Length
);
48 private static void CreateBlog()
50 Blog blog
= new Blog();
52 blog
.Author
= "Henry";
53 blog
.Name
= "Senseless";
58 public void OperateTheOtherOne()
60 Hand
[] hands
= Hand
.FindAll();
62 Assert
.AreEqual(0, hands
.Length
);
66 hands
= Hand
.FindAll();
68 Assert
.AreEqual(1, hands
.Length
);
71 private static void CreateHand()
73 Hand hand
= new Hand();
81 public void OperateBoth()
83 Blog
[] blogs
= Blog
.FindAll();
84 Hand
[] hands
= Hand
.FindAll();
86 Assert
.AreEqual(0, blogs
.Length
);
87 Assert
.AreEqual(0, hands
.Length
);
92 blogs
= Blog
.FindAll();
93 hands
= Hand
.FindAll();
95 Assert
.AreEqual(1, blogs
.Length
);
96 Assert
.AreEqual(1, hands
.Length
);