Refactored the Kernel registration fluent interface to be more readable, better suppo...
[castle.git] / Facilities / ActiveRecordIntegration / Castle.Facilities.ActiveRecordIntegration.Tests / IntegrationTestCase.cs
blob0acd81a2dd9ca2b5bd0dca1b62a86134469df51b
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.Facilities.ActiveRecordIntegration.Tests
17 using NUnit.Framework;
19 using Castle.Facilities.ActiveRecordIntegration.Tests.Model;
22 [TestFixture]
23 public class IntegrationTestCase : AbstractActiveRecordTest
25 [Test]
26 public void SimpleUsage()
28 Post.DeleteAll();
29 Blog.DeleteAll();
31 Blog[] blogs = Blog.FindAll();
33 Assert.IsNotNull( blogs );
34 Assert.AreEqual( 0, blogs.Length );
36 Blog blog = new Blog();
37 blog.Name = "hammett's blog";
38 blog.Author = "hamilton verissimo";
39 blog.Save();
41 blogs = Blog.FindAll();
43 Assert.IsNotNull( blogs );
44 Assert.AreEqual( 1, blogs.Length );
46 Blog retrieved = blogs[0];
47 Assert.IsNotNull( retrieved );
49 Assert.AreEqual( blog.Name, retrieved.Name );
50 Assert.AreEqual( blog.Author, retrieved.Author );
53 [Test]
54 public void ComponentAutoWiring()
56 WiringSession wsession = (WiringSession) container["wiring.service"];
58 wsession.UsingISessionFactory();
60 wsession.UsingISessionFactoryHolder();