By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,663 Members | 1,477 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,663 IT Pros & Developers. It's quick & easy.

Unit-testing applications that use the Microsoft.Patterns.EnterpriseLibrary.Data

P: n/a
From: da**********@gmail.com (CtrlAltDel)
Newsgroups: microsoft.public.dotnet.datatools
Subject: Unit-testing applications that use the
Microsoft.Patterns.EnterpriseLibrary.Data
Date: 15 Apr 2005 08:06:31 -0700

I've written a web application that uses the M.P.E.D namespace to do
all of its data layer tasks (and a nifty bit of code M.P.E.D is too!).
However, unit-testing is proving a bit of a problem, as the database
factory complains it is unable to locate the expected
dataconfiguration file :

1) MyBusinessObject.Tests.RegistrationFixture.SimpleR egistration :
System.Configuration.ConfigurationException : Invalid section name.
The section 'dataConfiguration' does not exist in the requested
configuration file
'E:\Inetpub\wwwroot\MyApplication\MyBusinessObject .Tests\bin\Debug\MyBusines
sObject.Tests.dll.config'
or the file
'c:\winnt\microsoft.net\framework\v1.1.4322\Config \machine.config'.
Make sure that the 'enterpriseLibrary.configurationSections'
configuration section exists in one of the files and that the section
'dataConfiguration' is defined.
at
Microsoft.Practices.EnterpriseLibrary.Configuratio n.ConfigurationBuilder.Val
idateSection(String
sectionName)
at
Microsoft.Practices.EnterpriseLibrary.Configuratio n.ConfigurationBuilder.Rea
dConfiguration(String
sectionName)
at
Microsoft.Practices.EnterpriseLibrary.Configuratio n.ConfigurationContext.Get
Configuration(String
sectionName)
at
Microsoft.Practices.EnterpriseLibrary.Data.Databas eConfigurationView.GetData
baseSettings()
at
Microsoft.Practices.EnterpriseLibrary.Data.Databas eConfigurationView.GetDefa
ultInstanceName()
at
Microsoft.Practices.EnterpriseLibrary.Data.Databas eProviderFactory.GetDefaul
tInstanceName()
at
Microsoft.Practices.EnterpriseLibrary.Configuratio n.ProviderFactory.CreateDe
faultInstance()
at
Microsoft.Practices.EnterpriseLibrary.Data.Databas eProviderFactory.CreateDef
aultDatabase()
at
Microsoft.Practices.EnterpriseLibrary.Data.Databas eFactory.CreateDatabase()
at MyBusinessObject.Application.Save() in
E:\Inetpub\wwwroot\MyApplication\MyBusinessObject\ Application.cs:line
96
at MyBusinessObject.Tests.RegistrationFixture.SimpleR egistration()
in
E:\Inetpub\wwwroot\MyApplication\MyBusinessObject. Tests\RegistrationFixture.
cs:line
90

I created an app.config and a dataconfiguration.config in the root
directory of the unit test library, and added a post-build event to
VS.NET to copy the .config files to the bin/debug folder, and indeed
the files get copied there, but the tests are still failing. Any idea
how to unit tests apps written with the EnterpriseLibrary?

Nov 22 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.