Ejemplo n.º 1
0
        public void ItCanPreventDuplication()
        {
            var config = GetUnorderedConfiguration();

            config.DuplicationStrategy = DuplicationStrategy.Prevent;
            var population = GetUnorderedChromosomes(config);

            var up = new UnorderedPopulation(config, population, typeof(PhraseGene));

            Assert.IsNotNull(up);

            up.AddToNextGeneration(population[0]);
            Assert.AreEqual(1, up.NextGeneration.Count);
            Assert.AreEqual(1, up.OptionsInPool.Count);

            up.AddToNextGeneration(population[0]);
            Assert.AreEqual(1, up.NextGeneration.Count);
            Assert.AreEqual(1, up.OptionsInPool.Count);
        }