[Mono-list] MySQL Connector - NUnit Issues

krdavis KEITH.DAVIS at ZUNISOFT.COM
Tue Aug 26 08:59:36 EDT 2008


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=5.1.6.0, 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.

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-tp19161535p19161535.html
Sent from the Mono - General mailing list archive at Nabble.com.



More information about the Mono-list mailing list