<p>I need to create a custom membership user and provider for an ASP.NET mvc app and I'm looking to use TDD.  I have created a User class which inherits from the MembershipUser class, but when I try to test it I get an error that I can't figure out.  How do I give it a valid provider name?  Do I just need to add it to web.config?  But I'm not even testing the web app at this point.</p>

<p>[failure] UserTests.SetUp.UserShouldHaveMembershipUserProperties
TestCase 'UserTests.SetUp.UserShouldHaveMembershipUserProperties'
failed: The membership provider name specified is invalid.
Parameter name: providerName
    System.ArgumentException
    Message: The membership provider name specified is invalid.
    Parameter name: providerName
    Source: System.Web</p>

[{'answer_id': 76883, 'author': 'ssmith', 'author_id': 13729, 'author_profile': 'https://Stackoverflow.com/users/13729', 'pm_score': 1, 'selected': False, 'text': "<p>Yes, you need to configure it in your configuration file (probably not web.config for a test library, but app.config).  You still use the  section and within that the  section to do the configuration.  Once you have that in place, you'll be able to instantiate your user and go about testing it.  At which point you'll likely encounter new problems, which you should post as separate questions, I think.</p>\n"}, {'answer_id': 243844, 'author': 'ddc0660', 'author_id': 16027, 'author_profile': 'https://Stackoverflow.com/users/16027', 'pm_score': 4, 'selected': True, 'text': '<p>The configuration to add to your unit test project configuration file would look something like this:</p>\n\n<pre><code>  &lt;connectionStrings&gt;\n     &lt;remove name="LocalSqlServer"/&gt;\n     &lt;add name="LocalSqlServer" connectionString="&lt;connection string&gt;" providerName="System.Data.SqlClient"/&gt;\n  &lt;/connectionStrings&gt;\n  &lt;system.web&gt;\n     &lt;membership defaultProvider="provider"&gt;\n       &lt;providers&gt;\n         &lt;add name="provider" applicationName="MyApp" type="System.Web.Security.SqlMembershipProvider" connectionStringName="LocalSqlServer" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" requiresQuestionAndAnswer="false" maxInvalidPasswordAttempts="3" passwordAttemptWindow="15"/&gt;\n       &lt;/providers&gt;\n     &lt;/membership&gt;\n  &lt;/system.web&gt;\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/76781', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/9938/']