Page 1 of 1

Unit tests using NUnit & Devart's LINQ to SQL ?

Posted: Thu 18 Feb 2010 19:19
by misztalm
Hiya, I'm currently having some fun with one of the trials for MySQL's dotConnect versions.

[C#]
I've created an assembly which is supposed to perform IO operations on an MySQL database using devart's linq to sql model, and a separate assembly to host unit tests using NUnit.

I've referenced assembly #1 in NUnit's assembly, created some basic tests for IO operations - and got a lot of failures. apparently there's an exception being thrown saying :

"Connection string \"DataContextConnectionString\" could not be found in the configuration file."

I'd apreciate some advice how to solve this, as this is getting increasingly frustrating.

Posted: Fri 19 Feb 2010 08:23
by JonasJ
.NET use the configurations file for the "main" assembly, in this case your test project. That config doesn't contain your connectionstring.

Posted: Mon 22 Feb 2010 08:42
by AndreyR
Hello, misztalm. Please let us know if the suggestion by JonasJ was helpful.

Posted: Mon 01 Mar 2010 10:04
by misztalm
Heya, yes it was - to some extent.

Here's a complete solution :
  • Create a new dll library project containing the NUnit tests.
  • Add the app.config file from the assembly containing Devart's dlls (the connection string needs to be present in the NUnit assembly)
  • In the NUnit application, edit the project's settings and have the project explicitely use the app.config file as the project's configuration.
Regards

Posted: Mon 01 Mar 2010 12:38
by AndreyR
Thank you for sharing your knowledge.