My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using System;
using NHibernateBootstrap.Core.Domain;
using NUnit.Framework;

namespace NHibernateBootstrap.Tests
{
[TestFixture]
public class BlogTestFixture : InMemoryDatabaseTest
{

[Test]
public void CanSaveAndLoadBlog()
{
object id;

using (var tx = session.BeginTransaction())
{
id = session.Save(new Blog
{
AllowsComments = true,
CreatedAt = new DateTime(2000, 1, 1),
Subtitle = "Hello",
Title = "World",
});

tx.Commit();
}

session.Clear();


using (var tx = session.BeginTransaction())
{
var blog = session.Get<Blog>(id);

Assert.AreEqual(new DateTime(2000, 1, 1), blog.CreatedAt);
Assert.AreEqual("Hello", blog.Subtitle);
Assert.AreEqual("World", blog.Title);
Assert.True(blog.AllowsComments);

tx.Commit();
}
}


}
}

Change log

r27 by wbinford on Sep 24, 2009   Diff
Modified the NHibernateBootstrap project
to use StructureMap to configure the
application using NHibernateRegistry and
introduced the UnitOfWork.
Go to: 
Project members, sign in to write a code review

Older revisions

r25 by wbinford on Sep 24, 2009   Diff
Created the NHibernateBootstrap
solution and project files based on
Ayende's blog entry, NHibernate Unit
Testing, http://ayende.com/Blog/archiv
e/2009/04/28/nhibernate-unit-
...
All revisions of this file

File info

Size: 1289 bytes, 47 lines
Powered by Google Project Hosting