I'm currently trying to write a unit / integration test using Effort as an in memory database provider.
I've been following the tutorial for creating a fake DbContext instance however I'm getting a System.ArgumentException : String cannot have zero length." on the creation of the EntityConnection.
Background:
- Using Entity Framework 6
- Using Effort 1.0.0.0
- Using Database First approach
- Using EntityConnectionFactory approach to creating a fake DbContext with Effort rather than DbConnectionFactory as described by the Effort tutorial
- My DbContext has the appropriate constructor taking a single DbConnection parameter
The connection string is defined in the app.config for the test runner and works with non-Effort based tests some of which read / write to the test database. I have removed any sensitive data:
<connectionStrings>
<add name="MyConnectionString"
connectionString="metadata=res://*/;provider=System.Data.SqlClient;provider connection string='data source=localhost;initial catalog=MyDatabaseName;persist security info=True;user id=myuser;password=mypassword;MultipleActiveResultSets=True;App=EntityFramework'"
providerName="System.Data.EntityClient" />
</connectionStrings>
The stack trace for the error is below:
System.ArgumentException : String cannot have zero length. at System.Reflection.RuntimeAssembly.GetResource(RuntimeAssembly assembly, String resourceName, ref UInt64 length, StackCrawlMarkHandle stackMark, Boolean skipSecurityCheck) at System.Reflection.RuntimeAssembly.GetManifestResourceStream(String name, ref StackCrawlMark stackMark, Boolean skipSecurityCheck) at System.Reflection.RuntimeAssembly.GetManifestResourceStream(String name) at Effort.Internal.Common.MetadataWorkspaceHelper.ParseResources(String resPath, List
1 csdl, List1 ssdl, List1 msl) at Effort.Internal.Common.MetadataWorkspaceHelper.ParseMetadata(String metadata, List1 csdl, List1 ssdl, List1 msl) at Effort.Internal.Common.MetadataWorkspaceHelper.Rewrite(String metadata, String providerInvariantName, String providerManifestToken) at Effort.EntityConnectionFactory.b__1(String metadata) at Effort.Internal.Caching.MetadataWorkspaceStore.<>c__DisplayClass1.b__0() at System.Lazy1.CreateValue() at System.Lazy1.LazyInitValue() at System.Lazy1.get_Value() at Effort.Internal.Caching.ConcurrentCache2.Get(TKey key, Func1 factory) at Effort.Internal.Caching.MetadataWorkspaceStore.GetMetadataWorkspace(String metadata, Func2 workspaceFactoryMethod) at Effort.EntityConnectionFactory.GetEffortCompatibleMetadataWorkspace(ref String entityConnectionString) at Effort.EntityConnectionFactory.CreateTransient(String entityConnectionString, IDataLoader dataLoader) at Effort.EntityConnectionFactory.CreateTransient(String entityConnectionString) at NUnitTests.EffortTests.BasicAdd() in EffortTests.cs: line 43
Does anyone have any idea what I'm doing wrong?