public void CrossOverTest() { Guid expectedOrganismId = Guid.NewGuid(); Organism expectedOrganism = new Organism(expectedOrganismId, _trainingRoom.TrainingRoomSettings, 0, new List <ConnectionGene>() { new ConnectionGene(expectedOrganismId, 1, 0, 3, -1), new ConnectionGene(expectedOrganismId, 2, 1, 3, 1, false), new ConnectionGene(expectedOrganismId, 3, 2, 3, 1), new ConnectionGene(expectedOrganismId, 4, 1, 4, -1), new ConnectionGene(expectedOrganismId, 5, 4, 3, 1, false), new ConnectionGene(expectedOrganismId, 6, 4, 5, 1), new ConnectionGene(expectedOrganismId, 7, 5, 3, 1), new ConnectionGene(expectedOrganismId, 8, 0, 4, -1), new ConnectionGene(expectedOrganismId, 9, 2, 4, 1), new ConnectionGene(expectedOrganismId, 10, 0, 5, 1) }); List <ConnectionGene> expectedGenes = expectedOrganism.ConnectionGenes.OrderBy(x => x.InnovationNumber).ToList(); Guid id1 = Guid.NewGuid(); Organism organism1 = new Organism(id1, _trainingRoom.TrainingRoomSettings, 0, new List <ConnectionGene>() { new ConnectionGene(id1, 1, 0, 3, -1), new ConnectionGene(id1, 2, 1, 3, -1, false), new ConnectionGene(id1, 3, 2, 3, -1), new ConnectionGene(id1, 4, 1, 4, -1), new ConnectionGene(id1, 5, 4, 3, -1), new ConnectionGene(id1, 8, 0, 4, -1) }); Guid id2 = Guid.NewGuid(); Organism organism2 = new Organism(id2, _trainingRoom.TrainingRoomSettings, 0, new List <ConnectionGene>() { new ConnectionGene(id2, 1, 0, 3, 1), new ConnectionGene(id2, 2, 1, 3, 1, false), new ConnectionGene(id2, 3, 2, 3, 1), new ConnectionGene(id2, 4, 1, 4, 1), new ConnectionGene(id2, 5, 4, 3, 1, false), new ConnectionGene(id2, 6, 4, 5, 1), new ConnectionGene(id2, 7, 5, 3, 1), new ConnectionGene(id2, 9, 2, 4, 1), new ConnectionGene(id2, 10, 0, 5, 1) }); Organism child = organism1.Crossover(organism2, _trainingRoom.TrainingRoomSettings, _organismFactory); List <ConnectionGene> childGenes = child.ConnectionGenes.OrderBy(a => a.InnovationNumber).ToList(); CollectionAssert.AreEqual(childGenes, expectedGenes); }