[Mono-list] MySQL Connector - NUnit Issues

Tue Aug 26 09:12:55 EDT 2008

I must be brain dead today. I first posted to the wrong list and then cut and
pasted it leaving out half my post.

In addition to what I posted below, I would like to know the correct way to
configure a unit test in Monodevelop for a library that needs a provider not
listed in the machine.config.  I have been googling this issue for a whole
day without any answers. It must be simple as my ASP.NET works and the test
fails (on the same machine).

Thanks in advance, and your patience with my bodged posting today!


krdavis wrote:
> First off I have scoured the list and found similar but not identical
> problems to mine without a solution. Development environemnt is Ubuntu
> 8.04, Mono 1.9.1 and Monodevelop 2.0 Alpha.
> I have used JUnit for years and I am new NUnit and the nuances of
> assemblies and how they are located and loaded.  I have an ASP.NET
> application that uses a custom membership provider (w/MySQL as the
> backend).  The provider works fine,  everything is being updated and what
> not.  I added the following to my web.config to get my MySQL connection
> working:
> <system.web>
> ...
> <system.data>
>     <DbProviderFactories>
>       <clear />
>       <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient"
>            description=".Net Framework Data Provider for MySQL"
>            type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data,
>                Version=, Culture=neutral,
> PublicKeyToken=c5687fc88969c44d" />
>     </DbProviderFactories>
>   </system.data>
> <system.web>
> This is great and the ASP.NET app works with MySQL, now the problem. 
> Being a good developer, I want to create some unit tests for my membership
> provider.  I created a separate test project from my memberhip library
> project.  I added a project reference to the membership project in my test
> project (good, the dll will get copied to the test project).
> In the test project I created an app.config with the above section from my
> web.config so my NUnit test will know about the MySQL provider.  I create
> a simple test and my membership dll (not the NUnit dll) throws:
> Failed to find or load the registered .Net Framework Data Provider
> 'MySql.Data.MySqlClient'. () ()
> My NUnit project copies the app.config to the appropriate output directory
> properly named <assembly-name>.dll.config.  Examining the build output
> directory shows the NUnit dll and its corresponding config file.  I added
> a bit of code to the nunit test and found it is not picking up the correct
> config file for the test dll. (it was picking up another config
> *md*.config, monodevelop maybe?) I thought the default behavior for NUnit
> was to pick up the config if I configured the build directory with the
> renamed dll config.
> I tried to open the dll.confg in the unit test directly (I think that just
> lets me query the values, it doesn't actually load the provider reference,
> if I am wrong here, please advise). 

View this message in context: http://www.nabble.com/MySQL-Connector---NUnit-Issues-tp19161535p19161792.html
Sent from the Mono - General mailing list archive at Nabble.com.

More information about the Mono-list mailing list