Exemple #1
0
        GivenInvalidEmailStrengthRegularExpressionConfigWhenemailStrengthRegularExpressionThenDefaultValueReturned()
        {
            // arrange
            var testClass = new MoqAutoMocker <BetterMembershipProvider>().ClassUnderTest;
            var config    = new NameValueCollection {
                { "emailStrengthRegularExpression", "(.*" }
            };

            // act // asert
            Assert.Throws <ProviderException>(() => testClass.Initialize("name", config));
        }
        public void GivenEmptyMaxPasswordLengthConfigWhenMaxPasswordLengthThenDefaultValueReturned()
        {
            // arrange
            var testClass = new MoqAutoMocker<BetterMembershipProvider>().ClassUnderTest;
            var config = new NameValueCollection { { "maxPasswordLength", string.Empty } };

            testClass.Initialize("name", config);

            // act
            var result = testClass.MaxPasswordLength;

            // assert
            Assert.That(result, Is.EqualTo(128));
        }
            GivenEmptyEmailStrengthRegularExpressionConfigWhenemailStrengthRegularExpressionThenEmptytValueReturned()
        {
            // arrange
            var testClass = new MoqAutoMocker<BetterMembershipProvider>().ClassUnderTest;
            var config = new NameValueCollection { { "emailStrengthRegularExpression", string.Empty } };

            testClass.Initialize("name", config);

            // act
            var result = testClass.EmailStrengthRegularExpression;

            // assert
            Assert.That(result, Is.EqualTo(string.Empty));
        }
Exemple #4
0
        GivenNoMinRequiredPasswordLengthConfigWhenMinRequiredNonalphanumericCharactersThenDefaultValueReturned()
        {
            // arrange
            var testClass = new MoqAutoMocker <BetterMembershipProvider>().ClassUnderTest;
            var config    = new NameValueCollection();

            testClass.Initialize("name", config);

            // act
            var result = testClass.MinRequiredPasswordLength;

            // assert
            Assert.That(result, Is.EqualTo(1));
        }
Exemple #5
0
        public void GivenEmptyMaxUserNameLengthConfigWhenMaxUserNameLengthThenDefaultValueReturned()
        {
            // arrange
            var testClass = new MoqAutoMocker <BetterMembershipProvider>().ClassUnderTest;
            var config    = new NameValueCollection {
                { "maxUserNameLength", string.Empty }
            };

            testClass.Initialize("name", config);

            // act
            var result = testClass.MaxUserNameLength;

            // assert
            Assert.That(result, Is.EqualTo(56));
        }
Exemple #6
0
        GivenEmptyEmailStrengthRegularExpressionConfigWhenemailStrengthRegularExpressionThenEmptytValueReturned()
        {
            // arrange
            var testClass = new MoqAutoMocker <BetterMembershipProvider>().ClassUnderTest;
            var config    = new NameValueCollection {
                { "emailStrengthRegularExpression", string.Empty }
            };

            testClass.Initialize("name", config);

            // act
            var result = testClass.EmailStrengthRegularExpression;

            // assert
            Assert.That(result, Is.EqualTo(string.Empty));
        }
Exemple #7
0
        public void GivenMinRequiredPasswordLengthConfigWhenMinRequiredPasswordLengthThenCorrectValueReturned()
        {
            // arrange
            var testClass = new MoqAutoMocker <BetterMembershipProvider>().ClassUnderTest;
            var config    = new NameValueCollection {
                { "minRequiredPasswordLength", "2" }
            };

            testClass.Initialize("name", config);

            // act
            var result = testClass.MinRequiredPasswordLength;

            // assert
            Assert.That(result, Is.EqualTo(2));
        }
Exemple #8
0
        GivenMinRequiredNonalphanumericCharactersConfigWhenMinRequiredNonalphanumericCharactersThenCorrectValueReturned()
        {
            // arrange
            var testClass = new MoqAutoMocker <BetterMembershipProvider>().ClassUnderTest;
            var config    = new NameValueCollection {
                { "minRequiredNonalphanumericCharacters", "2" }
            };

            testClass.Initialize("name", config);

            // act
            var result = testClass.MinRequiredNonAlphanumericCharacters;

            // assert
            Assert.That(result, Is.EqualTo(2));
        }
            GivenInvalidEmailStrengthRegularExpressionConfigWhenemailStrengthRegularExpressionThenDefaultValueReturned()
        {
            // arrange
            var testClass = new MoqAutoMocker<BetterMembershipProvider>().ClassUnderTest;
            var config = new NameValueCollection { { "emailStrengthRegularExpression", "(.*" } };

            // act // asert
            Assert.Throws<ProviderException>(() => testClass.Initialize("name", config));
        }
            GivenNoMinRequiredPasswordLengthConfigWhenMinRequiredNonalphanumericCharactersThenDefaultValueReturned()
        {
            // arrange
            var testClass = new MoqAutoMocker<BetterMembershipProvider>().ClassUnderTest;
            var config = new NameValueCollection();

            testClass.Initialize("name", config);

            // act
            var result = testClass.MinRequiredPasswordLength;

            // assert
            Assert.That(result, Is.EqualTo(1));
        }
        public void GivenMinRequiredPasswordLengthConfigWhenMinRequiredPasswordLengthThenCorrectValueReturned()
        {
            // arrange
            var testClass = new MoqAutoMocker<BetterMembershipProvider>().ClassUnderTest;
            var config = new NameValueCollection { { "minRequiredPasswordLength", "2" } };

            testClass.Initialize("name", config);

            // act
            var result = testClass.MinRequiredPasswordLength;

            // assert
            Assert.That(result, Is.EqualTo(2));
        }
            GivenMinRequiredNonalphanumericCharactersConfigWhenMinRequiredNonalphanumericCharactersThenCorrectValueReturned()
        {
            // arrange
            var testClass = new MoqAutoMocker<BetterMembershipProvider>().ClassUnderTest;
            var config = new NameValueCollection { { "minRequiredNonalphanumericCharacters", "2" } };

            testClass.Initialize("name", config);

            // act
            var result = testClass.MinRequiredNonAlphanumericCharacters;

            // assert
            Assert.That(result, Is.EqualTo(2));
        }