Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

TextBoxRegex - A Text Box with Data Validation

, 30 Jun 2010 CPOL
An enhanced text box control with powerful data validation capabilities
textboxregex_demo.zip
Chopeen.TextBoxRegex.dll
TestBoxRegExDemo.exe
textboxregex_help_chm.zip
TextBoxRegex.chm
textboxregex_src.zip
TextBoxRegex
Tests
TextBoxRegexDemo
#region Copyright (c) 2004 Marek Grzenkowicz
/*
 * Copyright (c) 2004 Marek Grzenkowicz
 * 
 * This software is provided 'as-is', without any warranty.
 * 
 * Permission is granted to anyone to use this software for any purpose.
 * 
 * This notice may not be removed from any source distibution; if you are
 * using this software in a product, this notice should be included in
 * materials distributed with your product.
 */
#endregion

#if DEBUG
using NUnit.Framework;

namespace Chopeen
{
    /// <summary>
    /// <exclude/>
    /// </summary>
    [TestFixture]
    public class TestTextBoxRegexPattern
    {
        private TextBoxRegex.Patterns pattern;

        [SetUp]
        public void CreatePatterns()
        {
            pattern = new TextBoxRegex.Patterns();
        }

        [Test]
        public void TestPatterns()
        {
            Assert.AreEqual(0, (int) TextBoxRegex.Patterns.None);
            Assert.AreEqual(1, (int) TextBoxRegex.Patterns.SmallLetters);
            Assert.AreEqual(2, (int) TextBoxRegex.Patterns.CapitalLetters);
            Assert.AreEqual(4, (int) TextBoxRegex.Patterns.Digits);
            Assert.AreEqual(8, (int) TextBoxRegex.Patterns.NonAlphaNumericCharacters);
            Assert.AreEqual(16, (int) TextBoxRegex.Patterns.CharacterCollection);
            Assert.AreEqual(32, (int) TextBoxRegex.Patterns.WildcardPattern);
            Assert.AreEqual(64, (int) TextBoxRegex.Patterns.RegexPattern);
            Assert.AreEqual(15, (int) TextBoxRegex.Patterns.All);
        }

        [Test]
        public void TestPatternAssignment()
        {
            pattern = TextBoxRegex.Patterns.SmallLetters;
            Assert.AreEqual(TextBoxRegex.Patterns.SmallLetters, pattern);
            Assert.AreEqual(1, (int) pattern);

            pattern = TextBoxRegex.Patterns.CapitalLetters | TextBoxRegex.Patterns.NonAlphaNumericCharacters;
            Assert.AreEqual(TextBoxRegex.Patterns.CapitalLetters | TextBoxRegex.Patterns.NonAlphaNumericCharacters, pattern);
            Assert.AreEqual(10, (int) pattern);
        }
    }
}
#endif

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

No Biography provided

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.141223.1 | Last Updated 30 Jun 2010
Article Copyright 2004 by Marek Grzenkowicz
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid