I'm loosely following an excellent series of blog posts by Kazi Manzur Rashid as a learning exercise for learning how to implement some new (for me at least) design patterns, but I'm getting trouble from the start.
I've basically copied his code for the Database
, RepositoryBase
and RepositoryBaseTests
classes, but when I try to run the tests, I get an error message saying
Unable to create instance of class Booking.Infrastructure.EntityFramework.Repositories.Tests.RepositoryBaseTests. Error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: Format of the initialization string does not conform to specification starting at index 0..
Through the debugger I have verified that the exception is thrown on the constructor for the Database
class, which looks like this:
public Database(
IConfigurationManager configurationManager,
string connectionstringName)
: base(
GetConnectionString(configurationManager, connectionstringName),
"BookingEntities")
{ // Nothing happens here }
The error is thrown when calling the base
constructor, and if I'd hard-code the values that I'm currently sending in, it would look like this:
: base("Dummy connStr", "BookingEntities")
Why doesn't this work?