I have a ASP.NET MVC site using Membership Provider. I have trouble testing some functionalities including register a new user.
The ASP.NET website doesn't have a way to delete/remove a registered user, so in my testing project (WatiN with NUnit), I am trying to delete a testing user account by calling Membership.DeleteUser(). Then I realize I cannot use this since I cannot configure the membership provider with web.config in my NUnit project (in visual studio).
How do I configure the membership provider without using ASP.NET?
You configure it in your app.config for your NUnit project. Check out this blog post. It provides an example (or close) to what you want to do.
Add the following to your app.config (from the first blog above):
<system.web> <membership defaultProvider="MeanWormMembershipProvider"> <providers> <remove name="AspNetSqlMembershipProvider"/> <add applicationName="MeanWorm" requiresQuestionAndAnswer="false" requiresUniqueEmail="true" minRequiredNonalphanumericCharacters="0" enablePasswordReset="true" passwordFormat="Hashed" connectionStringName="MeanWormConnectionString" name="MeanWormMembershipProvider" type="MeanWorm.Domain.Providers.MeanWormMembershipProvider,MeanWorm.Domain"/> </providers> </membership> </system.web>