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

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
misztalm
Posts: 2
Joined: Thu 18 Feb 2010 19:11

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

Post by misztalm » Thu 18 Feb 2010 19:19

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.

JonasJ
Posts: 8
Joined: Wed 25 Nov 2009 08:51

Post by JonasJ » Fri 19 Feb 2010 08:23

.NET use the configurations file for the "main" assembly, in this case your test project. That config doesn't contain your connectionstring.

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Mon 22 Feb 2010 08:42

Hello, misztalm. Please let us know if the suggestion by JonasJ was helpful.

misztalm
Posts: 2
Joined: Thu 18 Feb 2010 19:11

Post by misztalm » Mon 01 Mar 2010 10:04

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

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Mon 01 Mar 2010 12:38

Thank you for sharing your knowledge.

Post Reply