Added RedirectUsingNamedRoute
[castle.git] / ActiveRecord / Castle.ActiveRecord.Tests / MultipleDatabasesTestCase.cs
blob143cde3ad8b48a1875973a4df636d74289cc5039
1 // Copyright 2004-2008 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 Framework;
18 using Model;
19 using NUnit.Framework;
21 [TestFixture]
22 public class MultipleDatabasesTestCase : AbstractActiveRecordTest
24 [SetUp]
25 public void Setup()
27 Init();
29 ActiveRecordStarter.Initialize(GetConfigSource(),
30 typeof(Blog), typeof(Post), typeof(Hand), typeof(Test2ARBase));
32 Recreate();
35 [Test]
36 public void OperateOne()
38 Blog[] blogs = Blog.FindAll();
40 Assert.AreEqual(0, blogs.Length);
42 CreateBlog();
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";
54 blog.Save();
57 [Test]
58 public void OperateTheOtherOne()
60 Hand[] hands = Hand.FindAll();
62 Assert.AreEqual(0, hands.Length);
64 CreateHand();
66 hands = Hand.FindAll();
68 Assert.AreEqual(1, hands.Length);
71 private static void CreateHand()
73 Hand hand = new Hand();
75 hand.Side = "Right";
77 hand.Save();
80 [Test]
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);
89 CreateBlog();
90 CreateHand();
92 blogs = Blog.FindAll();
93 hands = Hand.FindAll();
95 Assert.AreEqual(1, blogs.Length);
96 Assert.AreEqual(1, hands.Length);