// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information. using System; using Xunit; using Assert = Microsoft.TestCommon.AssertEx; namespace WebMatrix.WebData.Test { public class WebSecurityTest { [Fact] public void VerifyExtendedMembershipProviderMethodsThrowWithInvalidProvider() { const string errorString = "To call this method, the \"Membership.Provider\" property must be an instance of \"ExtendedMembershipProvider\"."; Assert.Throws(() => WebSecurity.ConfirmAccount(""), errorString); Assert.Throws(() => WebSecurity.GeneratePasswordResetToken(""), errorString); Assert.Throws(() => WebSecurity.GetUserIdFromPasswordResetToken(""), errorString); Assert.Throws(() => WebSecurity.ResetPassword("", "whatever"), errorString); Assert.Throws(() => WebSecurity.CreateUserAndAccount("", "whatever"), errorString); Assert.Throws(() => WebSecurity.CreateAccount("", "whatever"), errorString); Assert.Throws(() => WebSecurity.IsConfirmed("whatever"), errorString); Assert.Throws(() => WebSecurity.GetPasswordFailuresSinceLastSuccess("whatever"), errorString); Assert.Throws(() => WebSecurity.GetCreateDate("whatever"), errorString); Assert.Throws(() => WebSecurity.GetLastPasswordFailureDate("whatever"), errorString); Assert.Throws(() => WebSecurity.GetPasswordChangedDate("whatever"), errorString); } } }