- .Net4.0
- MVC 2
- NHibernate
- Nunit
I am trying to verify user creation. From my test, I call the following:
MembershipCreateStatus status; // _session is my current NHibernate session. var mmp = new MyMembershipProvider(_session); mmp.CreateUser(username, password, " something@example.com ", "", "", true, Guid.NewGuid(), out status);
In the CreateUser method CreateUser he accomplishes this:
var user = new MembershipUser(Name, username, providerUserKey, email, passwordQuestion, passwordAnswer, isApproved, false, DateTime.Now, DateTime.Now, DateTime.Now, DateTime.Now, DateTime.Now);
... before throwing this exception:
The membership provider name specified is invalid. Parameter name: providerName
I have my name set to MyMembershipProvider , and in Web.config I have the following:
<add name="OnyxMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
And also my connection string:
<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient" />
Now I assume that the problem is that my tests create SQLite DB and web.Config is trying to hit my SqlServer DB, but I'm not sure how to do it.