示例#1
0
        public override object?Generate(IFuzzProfile profile, Type type, FuzzRandom random)
        {
            var constructor = random.Choice(type.GetConstructors());

            var arguments = constructor.GetParameters()
                            .Select(p => profile.Generate(p.ParameterType, random));

            return(constructor.Invoke(arguments.ToArray()));
        }
示例#2
0
        public override object?Generate(IFuzzProfile profile, Type type, FuzzRandom random)
        {
            // Only find direct subclasses. Indirect subclasses can be found recursively
            var candidateClasses = DirectSubclassesOf(type)
                                   .ToList();

            var generatedType = random.Choice(candidateClasses);

            return(profile.Generate(generatedType, random));
        }
示例#3
0
        public override object?Generate(IFuzzProfile profile, Type type, FuzzRandom random)
        {
            Check.IsTrue(type.IsEnum);

            return(random.Choice(type.GetEnumValues()));
        }
示例#4
0
 public override object?Generate(IFuzzProfile profile, Type type, FuzzRandom random)
 {
     return(random.Choice(_items));
 }