Example #1
0
        public void MutatorTest4()
        {
            Organism organism = new Organism();

            organism.Chromosomes.Add(new Chromosome(1, "10"));

            int    runCount            = 100000;
            double mutationProbability = 0;

            MutationCounter mutator         = new MutationCounter();
            IRandom         rand            = new Rand();
            Mutator         mutationManager = new Mutator(rand, mutationProbability);

            mutationManager.AddMutator(mutator);
            for (int i = 0; i <= runCount - 1; i++)
            {
                mutationManager.Mutate(organism);
            }

            Assert.AreEqual(0, mutator.MutationCount);
            Assert.AreEqual("10", organism.Chromosomes[0].ToString());
        }