Пример #1
0
        public StringListVariationGenerator(
            IList <string> stringList,
            IList <ISuppressor> suppressors = null,
            ICharMapper mapper = null)
            : base(suppressors, mapper)
        {
            StringList = new ReadOnlyCollection <string>(stringList.Distinct().ToList());
            LoopCount  = (ulong)StringList.Count;

            Reset();
        }
Пример #2
0
        protected VariationGeneratorBase(IList <ISuppressor> suppressors, ICharMapper mapper = null)
        {
            if (suppressors != null && suppressors.Count > 0)
            {
                Suppressors = new ReadOnlyCollection <ISuppressor>(suppressors);
                BreaksRestrictionsInternal = BreaksRestrictions;
            }

            CharMapper = mapper;
            if (CharMapper != null)
            {
                MapCharactersInternal = MapCharacters;
            }
        }
Пример #3
0
        public CompoundVariationGenerator(
            IList <IVariationGenerator> generators,
            IList <ISuppressor> suppressors = null,
            ICharMapper mapper = null)
            : base(suppressors, mapper)
        {
            if (generators == null || generators.Count == 0)
            {
                throw new ArgumentNullException(nameof(generators), $"Empty parameter: {nameof(generators)}");
            }

            VariationGenerators = new ReadOnlyCollection <IVariationGenerator>(generators);

            LoopCount = GetLoopCount();

            Reset();
        }
        public NumberRangeVariationGenerator(
            int minValue,
            int maxValue,
            int step      = 1,
            string format = null,
            IList <ISuppressor> suppressors = null,
            ICharMapper mapper = null)
            : base(suppressors, mapper)
        {
            MinValue = minValue;
            MaxValue = maxValue;
            Step     = step <= 0 ? 1 : step;
            Format   = format ?? "N0";

            LoopCount = 1 + (ulong)Math.Floor((MaxValue - MinValue) / (double)Step);

            Reset();
        }
        public FixedVariationGenerator(
            string chars,
            int?minLength     = null,
            CharCase charCase = CharCase.AsDefined,
            IList <ISuppressor> suppressors = null,
            ICharMapper mapper = null)
            : base(suppressors, mapper)
        {
            if (string.IsNullOrEmpty(chars))
            {
                throw new ArgumentNullException(nameof(chars), $"Empty parameter: {nameof(chars)}");
            }

            OriginalChars = chars;
            MinLength     = NormalizeMinLength(minLength);
            CharCase      = charCase;

            BuildChars();
            Reset();

            LoopCount = GetLoopCount();
        }