public void DeleteConfig_DeletesConfigWithGivenID() { var id = 2; var configs = _handler.ListConfigs(); Assert.IsTrue(configs.Any(c => c.Key == id)); var generationBefore = _handler.ReadGeneration(id, 0); Assert.AreEqual(2, generationBefore.Individuals.Count); _handler.DeleteConfig(id); var configsAfter = _handler.ListConfigs(); Assert.IsFalse(configsAfter.Any(c => c.Key == id)); var generationAfter = _handler.ReadGeneration(id, 0); Assert.AreEqual(0, generationAfter.Individuals.Count); }
public void SetCurrentGeneration_ReadsCurrentGeneration() { Generation generation = _handler.ReadGeneration(2, 0); Assert.IsNotNull(generation); Assert.AreEqual(2, generation.Individuals.Count); var i1 = generation.Individuals.First(); Assert.AreEqual("123", i1.Genome); Assert.AreEqual(3, i1.MatchesAsLastSurvivor); Assert.AreEqual(4, i1.MatchesSurvived); Assert.AreEqual(4, i1.MatchesPlayed); Assert.AreEqual("123,321", i1.PreviousCombatantsString); Assert.AreEqual(2, i1.PreviousCombatants.Count); Assert.AreEqual("123", i1.PreviousCombatants.First()); Assert.AreEqual("321", i1.PreviousCombatants[1]); //BaseMembers Assert.AreEqual(42, i1.Score); Assert.AreEqual(123, i1.Summary.Cost); Assert.AreEqual(6, i1.Summary.ModulesAdded); Assert.AreEqual(new Color(1, 2, 3), i1.Summary.Color); Assert.AreEqual("species42", i1.Summary.Species); Assert.AreEqual("speciesV42", i1.Summary.VerboseSpecies); Assert.AreEqual("subspecies42", i1.Summary.Subspecies); Assert.AreEqual("subspeciesV42", i1.Summary.VerboseSubspecies); }
public void SetCurrentGeneration_ReadsCurrentGeneration() { var generation = _handler.ReadGeneration(0, 0); Assert.IsNotNull(generation); Assert.AreEqual(2, generation.Individuals.Count); var i1 = generation.Individuals.First(); Assert.AreEqual("123", i1.Genome); Assert.AreEqual(42, i1.Score); Assert.AreEqual(3, i1.MatchesPlayed); Assert.AreEqual(1, i1.MatchesSurvived); Assert.AreEqual(2, i1.KilledAllDrones); Assert.AreEqual(5, i1.TotalDroneKills); Assert.AreEqual("123,321", i1.MatchScoresString); Assert.AreEqual(2, i1.MatchScores.Count); Assert.AreEqual(123, i1.MatchScores.First()); Assert.AreEqual(321, i1.MatchScores[1]); }