|
View:
New views
5 Messages
—
Rating Filter:
Alert me
|
|
|
MySQL Connector - NUnit IssuesFirst 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 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). |
|
|
Re: MySQL Connector - NUnit IssuesI 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! Keith
|
|
|
Re: MySQL Connector - NUnit IssuesI 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@... > [mailto:mono-list-bounces@...] On Behalf Of krdavis > Sent: Tuesday, August 26, 2008 6:00 AM > To: mono-list@... > 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@... > http://lists.ximian.com/mailman/listinfo/mono-list > _______________________________________________ Mono-list maillist - Mono-list@... http://lists.ximian.com/mailman/listinfo/mono-list |
|
|
Re: MySQL Connector - NUnit IssuesThanks 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@...> 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@... >> [mailto:mono-list-bounces@...] On Behalf Of krdavis >> Sent: Tuesday, August 26, 2008 6:00 AM >> To: mono-list@... >> 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@... >> http://lists.ximian.com/mailman/listinfo/mono-list >> > > > > _______________________________________________ > Mono-list maillist - Mono-list@... > http://lists.ximian.com/mailman/listinfo/mono-list _______________________________________________ Mono-list maillist - Mono-list@... http://lists.ximian.com/mailman/listinfo/mono-list |
|
|
Re: MySQL Connector - NUnit IssuesThis appears to be a monodevelop bug as the unit test runs as expected when using a standalone installation of NUnit. The integrated NUnit in monodevelop is picking up "/monodevelop-1.9/build/bin/mdhost.exe.config" when executing the unit test instead of the properly named app.config co-located with the test assembly. I filed a post on the mono-monodevelop list reporting the issue.
|
| Free Forum Powered by Nabble | Forum Help |