Esempio n. 1
0
        public void ThrowsOnIncorrectParams()
        {
            var       sut        = new SelectionSampling();
            var       population = new[] { 1, 2 };
            const int sampleSize = 3;

            Assert.Throws <ArgumentException>(() => sut.GetRandomSample(population, sampleSize));
        }
Esempio n. 2
0
        public void CanSelectSample()
        {
            var       sut        = new SelectionSampling();
            var       population = new[] { 1, 2 };
            const int sampleSize = 1;
            var       sample     = sut.GetRandomSample(population, sampleSize);

            Assert.True(sample[0] != 0);
        }
Esempio n. 3
0
        public void Fuzzy()
        {
            var sut        = new SelectionSampling();
            var random     = new Random();
            var population = new int[100];

            for (var i = 0; i < population.Length; i++)
            {
                population[i] = random.Next(1, 10000);
            }
            var sampleSize = random.Next(1, 100);

            var sample = sut.GetRandomSample(population, sampleSize);

            Assert.True(sample.All(arg => arg != 0));
        }