// 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>();
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        // Constructors

        public DateTimeInstanceGenerator(IInstanceGeneratorProvider provider)
            : base(provider)
        {
            longInstanceGeneratorProvider = provider.GetInstanceGenerator <long>();
        }
コード例 #4
0
        // Constructors

        public SByteInstanceGenerator(IInstanceGeneratorProvider provider)
            : base(provider)
        {
            byteItemGenerator = provider.GetInstanceGenerator <byte>();
        }
コード例 #5
0
        // 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>();
        }