Example #1
0
        public object Generate()
        {
            string        result        = "";
            ByteGenerator byteGenerator = new ByteGenerator();
            CharGenerator charGenerator = new CharGenerator();

            byte stringSize = (byte)byteGenerator.Generate();

            for (int i = 0; i < stringSize; i++)
            {
                result = result + charGenerator.Generate();
            }

            return(result);
        }
Example #2
0
        public object Generate(Type baseType)
        {
            IList           result = (IList)Activator.CreateInstance(typeof(List <>).MakeGenericType(baseType));
            IValueGenerator baseTypeGenerator;

            if (baseTypesGenerators.TryGetValue(baseType, out baseTypeGenerator))
            {
                byte listSize = (byte)byteGenerator.Generate();

                for (int i = 0; i < listSize; i++)
                {
                    result.Add(baseTypeGenerator.Generate());
                }
            }
            return(result);
        }