public AutoBuilderConfiguration(
     CharacterSetType stringCharacterSetType = CharacterSetType.Alpha,
     Casing stringCasing            = Casing.ProperCase,
     Spaces stringSpaces            = Spaces.None,
     Language defaultLanguage       = Language.English,
     int intMinimum                 = 1,
     int intMaximum                 = 10000,
     double doubleMinimum           = 100,
     double doubleMaximum           = 100000,
     short shortMinimum             = 1,
     short shortMaximum             = 32000,
     bool defaultBoolean            = true,
     int stringMinLength            = 5,
     int stringMaxLength            = 25,
     int maxDepth                   = 5,
     int defaultCollectionItemCount = 2)
     : this(
         DateTime.UtcNow,
         stringCharacterSetType,
         stringCasing,
         stringSpaces,
         defaultLanguage,
         intMinimum,
         intMaximum,
         doubleMinimum,
         doubleMaximum,
         shortMinimum,
         shortMaximum,
         defaultBoolean,
         stringMinLength,
         stringMaxLength,
         maxDepth,
         defaultCollectionItemCount)
 {
 }
示例#2
0
        private List <string> GetCharacterSet(CharacterSetType characterSetType, Casing casing)
        {
            var characters = new List <string>();

            switch (characterSetType)
            {
            case CharacterSetType.Alpha:
                GetAlphaCharacterSet(casing, characters);
                break;

            case CharacterSetType.AlphaNumeric:
                GetAlphaNumericCharacterSet(casing, characters);
                break;

            case CharacterSetType.Numeric:
                GetNumericCharacterSet(characters);
                break;

            default:
                GetAnythingCharacterSet(casing, characters);
                break;
            }

            return(characters);
        }
示例#3
0
 /// <summary>
 /// Override model string property.
 /// </summary>
 /// <param name="expression">The expression.</param>
 /// <param name="length">The length.</param>
 /// <param name="characterSetType">Type of the character set.</param>
 /// <returns>Returns this.</returns>
 public IAutoBuilderOverrides <TModel> With(
     Expression <Func <TModel, string> > expression,
     int length,
     CharacterSetType characterSetType)
 {
     this.Actions.Add(() => SetStringPropertyUsingNewRandomizerSetting(() => NAuto.GetRandomString(length, characterSetType), expression));
     return(this);
 }
        public static string Get(int length, CharacterSetType characterSetType, Spaces spaces, Casing casing,
            Language language = Language.English)
        {
            SetLanguageCharacterSets(language);
            SetLanguageNumbers(language);
            var characters = GetCharacterSet(characterSetType, casing);

            var sb = BuildRandomString(length, spaces, characters);

            return ConvertToProperCaseIfRequired(sb.ToString(), casing);
        }
示例#5
0
 /// <summary>
 /// Override model string property.
 /// </summary>
 /// <param name="expression">The expression.</param>
 /// <param name="minLength">The minimum length.</param>
 /// <param name="maxLength">The maximum length.</param>
 /// <param name="characterSetType">Type of the character set.</param>
 /// <param name="spaces">The spaces.</param>
 /// <param name="casing">The casing.</param>
 /// <returns>Returns this.</returns>
 public IAutoBuilderOverrides <TModel> With(
     Expression <Func <TModel, string> > expression,
     int minLength,
     int maxLength,
     CharacterSetType characterSetType,
     Spaces spaces,
     Casing casing)
 {
     this.Actions.Add(() => SetStringPropertyUsingNewRandomizerSetting(() => NAuto.GetRandomString(minLength, minLength, characterSetType, spaces, casing), expression));
     return(this);
 }
示例#6
0
        public string Get(int minLength, int maxLength, CharacterSetType characterSetType, Spaces spaces, Casing casing, Language language = Language.English)
        {
            SetLanguageCharacterSets(language);
            SetLanguageNumbers(language);
            var characters = GetCharacterSet(characterSetType, casing);

            var length = _random.Next(minLength, maxLength);

            var sb = BuildRandomString(length, spaces, characters);

            return(ConvertToProperCaseIfRequired(sb.ToString(), casing));
        }
示例#7
0
        internal static H5T.cset_t GetCharacterSet(CharacterSetType characterSetType)
        {
            switch (characterSetType)
            {
            case CharacterSetType.ASCII:
                return(H5T.cset_t.ASCII);

            case CharacterSetType.UTF8:
                return(H5T.cset_t.UTF8);

            default:
                throw new ArgumentOutOfRangeException(nameof(characterSetType), characterSetType, null);
            }
        }
 public AutoBuilderConfiguration(
     DateTime defaultDateTime,
     CharacterSetType stringCharacterSetType = CharacterSetType.Alpha,
     Casing stringCasing            = Casing.ProperCase,
     Spaces stringSpaces            = Spaces.None,
     Language defaultLanguage       = Language.English,
     int intMinimum                 = 1,
     int intMaximum                 = 10000,
     double doubleMinimum           = 100,
     double doubleMaximum           = 100000,
     short shortMinimum             = 1,
     short shortMaximum             = 32000,
     bool defaultBoolean            = true,
     int stringMinLength            = 5,
     int stringMaxLength            = 25,
     int maxDepth                   = 5,
     int defaultCollectionItemCount = 2)
 {
     this.DefaultDateTime = defaultDateTime;
     this.DefaultStringCharacterSetType = stringCharacterSetType;
     this.DefaultStringCasing           = stringCasing;
     this.DefaultStringSpaces           = stringSpaces;
     this.DefaultLanguage            = defaultLanguage;
     this.IntMinimum                 = intMinimum;
     this.IntMaximum                 = intMaximum;
     this.DoubleMinimum              = doubleMinimum;
     this.DoubleMaximum              = doubleMaximum;
     this.ShortMinimum               = shortMinimum;
     this.ShortMaximum               = shortMaximum;
     this.DefaultBoolean             = defaultBoolean;
     this.StringMinLength            = stringMinLength;
     this.StringMaxLength            = stringMaxLength;
     this.MaxDepth                   = maxDepth;
     this.DefaultCollectionItemCount = defaultCollectionItemCount;
     this.Conventions                = new Conventions();
 }
示例#9
0
文件: NAuto.cs 项目: getsetcode/NAuto
 /// <summary>
 /// Gets the random string.
 /// </summary>
 /// <param name="length">The length.</param>
 /// <param name="characterSetType">Type of the character set.</param>
 /// <param name="spaces">The spaces.</param>
 /// <param name="casing">The casing.</param>
 /// <param name="language">The language.</param>
 /// <returns>Random string.</returns>
 public static string GetRandomString(int length, CharacterSetType characterSetType, Spaces spaces, Casing casing, Language language = Language.English)
 {
     return(new RandomStringGenerator().Get(length, characterSetType, spaces, casing, language));
 }
        private static List<string> GetCharacterSet(CharacterSetType characterSetType, Casing casing)
        {
            var characters = new List<string>();

            switch (characterSetType)
            {
                case CharacterSetType.Alpha:
                    GetAlphaCharacterSet(casing, characters);
                    break;
                case CharacterSetType.AlphaNumeric:
                    GetAlphaNumericCharacterSet(casing, characters);
                    break;
                case CharacterSetType.Numeric:
                    GetNumericCharacterSet(characters);
                    break;
                default:
                    GetAnythingCharacterSet(casing, characters);
                    break;
            }
            return characters;
        }
示例#11
0
 public Token(byte[] token, CharacterSetType characterSetClass)
 {
     this.token             = token;
     this.characterSetClass = characterSetClass;
 }
 public int ReadFrom(byte[] buffer, int offset)
 {
     Type        = (CharacterSetType)buffer[offset];
     Information = EndianUtilities.ToByteArray(buffer, offset + 1, 63);
     return(64);
 }
 public int ReadFrom(byte[] buffer, int offset)
 {
     Type = (CharacterSetType)buffer[offset];
     Information = Utilities.ToByteArray(buffer, offset + 1, 63);
     return 64;
 }
示例#14
0
 public Settings(DateTimeType dateTimeType, bool lowerCaseNaming, bool throwOnError, bool overrideExistingData, CharacterSetType characterSetType, CharacterPaddingType characterPaddingType) : this(dateTimeType, lowerCaseNaming, throwOnError, overrideExistingData)
 {
     CharacterPaddingType = characterPaddingType;
     CharacterSetType     = characterSetType;
 }
示例#15
0
文件: NAuto.cs 项目: getsetcode/NAuto
 /// <summary>
 /// Gets the random string.
 /// </summary>
 /// <param name="minLength">The minimum length.</param>
 /// <param name="maxLength">The maximum length.</param>
 /// <param name="characterSetType">Type of the character set.</param>
 /// <param name="spaces">The spaces.</param>
 /// <param name="language">The language.</param>
 /// <returns>Random string.</returns>
 public static string GetRandomString(int minLength, int maxLength, CharacterSetType characterSetType, Spaces spaces, Language language = Language.English)
 {
     return(new RandomStringGenerator().Get(minLength, maxLength, characterSetType, spaces, Casing.Any, language));
 }
示例#16
0
 public static bool Validate(Token token, CharacterSetType tokenType, params string[] contents)
 => token.characterSetClass == tokenType && contents.Contains(token.ToString());
示例#17
0
 public CharacterSetListEntry(CharacterSetType characterSetType, string designationSequenceTail)
 {
     CharacterSetType        = characterSetType;
     DesignationSequenceTail = designationSequenceTail;
 }