-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Testing NHibernate Code
PostPosted: Mon May 28, 2007 9:04 pm 
Newbie

Joined: Fri May 25, 2007 2:47 pm
Posts: 2
Hi Everyone. I'm a bit of a (N)Hibernate newbie so bear with me.

I know that in .NET your app.config is used from whatever assembly is initially entered. In my case, I have a windows form which references a data access layer which uses nhibernate. That is to say, I am using 2 assemblies (an .exe for the windows form and a .dll for the data access layer)

So to configure NHibernate, I have to include the usual nhibernate section in my windows form app.config file, and everything works peachy.

Here's my question: I am writing unit tests specifically on my data access layer using NUnit. Since my database configuration is in the app.config (in the Windows Form) any tests automatically bomb out because NHibernate can't configure itself. How can I run my NUnit tests (which are a part of my data access layer assembly) without duplicating my app.config file?

My initial thought it so bring my NUnit tests into their own assembly and create an app.config file there... which seems to make sense since really that's another entry point into my application.

What are the thoughts of this community when testing NHibernate code, and where can I find out more information about testing with NUnit?

_________________
--Ken


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 29, 2007 12:52 pm 
Regular
Regular

Joined: Mon May 16, 2005 2:15 pm
Posts: 59
Ken,

Yes, what you said is how I've seen most people do it, Unit Tests in their own assembly which has it's own app.config file.

Or, you could use NAnt and have a build to copies/names the app config file properly depending on whether your are doing a test build or not. See Jean-Paul Boodhoos series http://www.jpboodhoo.com/blog/NAntStarterSeries.aspx .

BOb


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 29, 2007 2:16 pm 
Newbie

Joined: Fri May 25, 2007 2:47 pm
Posts: 2
Thanks for your response. I'm going to give that a try.

_________________
--Ken


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.