GetInts() public method

Return an array of random ints with values in a specified range.
public GetInts ( int min, int max, int count ) : int[]
min int
max int
count int
return int[]
        /// <summary>
        /// Get the collection of values to be used as arguments
        /// </summary>
        public override IEnumerable GetData(ParameterInfo parameter)
        {
            Randomizer r = Randomizer.GetRandomizer(parameter);
            IList      values;

            switch (sampleType)
            {
            default:
            case SampleType.Raw:
                values = r.GetDoubles(count);
                break;

            case SampleType.IntRange:
                values = r.GetInts(min, max, count);
                break;

            case SampleType.DoubleRange:
                values = r.GetDoubles(dmin, dmax, count);
                break;
            }

            // Copy the random values into the data array
            // and call the base class which may need to
            // convert them to another type.
            this.data = new object[values.Count];
            for (int i = 0; i < values.Count; i++)
            {
                this.data[i] = values[i];
            }

            return(base.GetData(parameter));
        }
Exemplo n.º 2
0
        public new IEnumerable GetData(ParameterInfo parameter)
        {
            Randomizer randomizer = Randomizer.GetRandomizer(parameter);
            IList      list;

            switch (sampleType)
            {
            default:
                list = randomizer.GetDoubles(count);
                break;

            case SampleType.IntRange:
                list = randomizer.GetInts(min, max, count);
                break;

            case SampleType.DoubleRange:
                list = randomizer.GetDoubles(dmin, dmax, count);
                break;
            }
            data = new object[list.Count];
            for (int i = 0; i < list.Count; i++)
            {
                data[i] = list[i];
            }
            return(base.GetData(parameter));
        }
Exemplo n.º 3
0
 public void Setup()
 {
     var rnd = new Randomizer();
     _instance = new DcmIntegerString(DicomTags.ReferencedFrameNumber);
     _instance.SetValues(
         rnd.GetInts(0, 65535, 5000).Select(i => i.ToString(CultureInfo.InvariantCulture)).
         Concat(new[] { "32767" }).ToArray());
 }
Exemplo n.º 4
0
        public void TestRangeSelection()
        {
            Randomizer randomizer = new Randomizer();
            int[] indices = randomizer.GetInts(0, this.selectionModel.Items.Count, 2);
            Array.Sort(indices);
            this.selectionModel.SelectRange(indices[0], indices[1]);

            AssertRangeSelected(indices);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Get the collection of values to be used as arguments
        /// </summary>
        public override IEnumerable GetData(ParameterInfo parameter)
        {
            Randomizer r = Randomizer.GetRandomizer(parameter);

            switch (sampleType)
            {
            default:
            case SampleType.Raw:
                return(r.GetDoubles(count));

            case SampleType.IntRange:
                return(r.GetInts(min, max, count));

            case SampleType.DoubleRange:
                return(r.GetDoubles(dmin, dmax, count));
            }
        }
Exemplo n.º 6
0
        public void TestSelectAllThenRange()
        {
            Randomizer randomizer = new Randomizer();
            int[] indices = randomizer.GetInts(0, this.selectionModel.Items.Count, 2);
            Array.Sort(indices);

            this.selectionModel.Select(this.selectionModel.Items[indices[0]]);
            this.selectionModel.SelectAll();
            this.selectionModel.SelectRange(indices[1], true);

            this.AssertRangeSelected(indices);
        }