// Constructors /// <summary> /// <see cref="ClassDocTemplate.Ctor" copy="true" /> /// </summary> /// <param name="provider">Instance generator provider this generator is bound to.</param> public WrappingInstanceGenerator(IInstanceGeneratorProvider provider) : base(provider) { BaseGenerator1 = provider.GetInstanceGenerator <TBase1>(); BaseGenerator2 = provider.GetInstanceGenerator <TBase2>(); BaseGenerator3 = provider.GetInstanceGenerator <TBase3>(); }
public override Tuples.Tuple GetInstance(Random random) { int position = random.Next(0, commonProbability); foreach (KeyValuePair <Type[], int> descriptor in descriptors) { if (position <= descriptor.Value) { Type[] types = descriptor.Key; Tuples.Tuple tuple = Tuples.Tuple.Create(types); for (int i = 0; i < types.Length; i++) { var type = types[i]; object value = provider.GetInstanceGenerator(type).GetInstance(random); tuple.SetValue(i, value); } return(tuple); } position -= descriptor.Value; } Debug.Assert(false); return(null); }
// Constructors public DateTimeInstanceGenerator(IInstanceGeneratorProvider provider) : base(provider) { longInstanceGeneratorProvider = provider.GetInstanceGenerator <long>(); }
// Constructors public SByteInstanceGenerator(IInstanceGeneratorProvider provider) : base(provider) { byteItemGenerator = provider.GetInstanceGenerator <byte>(); }
// Constructors /// <summary> /// <see cref="ClassDocTemplate.Ctor" copy="true" /> /// </summary> /// <param name="provider">Instance generator provider this generator is bound to.</param> public WrappingInstanceGenerator(IInstanceGeneratorProvider provider) : base(provider) { BaseGenerator = provider.GetInstanceGenerator <TBase>(); }