[Mono-list] MySQL Connector - NUnit Issues

Keith R.Davis keith.davis at zunisoft.com
Tue Aug 26 15:29:05 EDT 2008


Thanks for the tip! I was also going to try adding the db provider to the
machine.config as temporary solution. I will check it out and report back
what I find...

On Tue, 26 Aug 2008 12:20:49 -0700, "Charlie Poole" <charlie at nunit.com>
wrote:
> I think this is a question of how the assembly is loaded by
> monodevelop, which may not actually use NUnit to create the
> appdomain - don't take this as gospel, I don't know the MD
> code. When NUnit does it *itself* it creates an AppDomain
> that uses a config file following the naming pattern you
> specified.
> 
> One way to test this... run the assembly directly using
> the nunit console or gui runner from the same release of
> nunit that your copy of MD uses. If it works, then you
> have an MD issue, if not it's an NUnit issue.
> 
> Charlie
> 
>> -----Original Message-----
>> From: mono-list-bounces at lists.ximian.com 
>> [mailto:mono-list-bounces at lists.ximian.com] On Behalf Of krdavis
>> Sent: Tuesday, August 26, 2008 6:00 AM
>> To: mono-list at lists.ximian.com
>> Subject: [Mono-list] MySQL Connector - NUnit Issues
>> 
>> 
>> 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-tp1916153
>> 5p19161535.html
>> Sent from the Mono - General mailing list archive at Nabble.com.
>> 
>> _______________________________________________
>> Mono-list maillist  -  Mono-list at lists.ximian.com 
>> http://lists.ximian.com/mailman/listinfo/mono-list
>> 
> 
> 
> 
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list



More information about the Mono-list mailing list