public void JustSeeding() { // For readability Species.IDataset spp = core.Species; foreach (ActiveSite activeSite in landscape) { expectedSite = activeSite; actualSpecies_SeedingAlg.Clear(); actualSpecies_AddNewCohort.Clear(); if (activeSite.SharesData) { if (activeSite.LocationInBlock == new Location(1, 1)) { SetList(expectedSpecies, spp[0], spp[1], spp[2], spp[3], spp[4], spp[5], spp[6], spp[7], spp[8], spp[9]); SetList(speciesThatReproduce, spp[2], spp[5], spp[7]); } else if (activeSite.LocationInBlock == new Location(1, 2)) { SetList(expectedSpecies, spp[0], spp[1], spp[3], spp[4], spp[6], spp[8], spp[9]); SetList(speciesThatReproduce, spp[0], spp[4]); } else if (activeSite.LocationInBlock == new Location(2, 1)) { SetList(expectedSpecies, spp[1], spp[3], spp[6], spp[8], spp[9]); SetList(speciesThatReproduce, spp[1], spp[6], spp[8]); } else { Assert.AreEqual(new Location(2, 2), activeSite.LocationInBlock); SetList(expectedSpecies, spp[3], spp[9]); SetList(speciesThatReproduce, spp[3]); } } else { // Since planting, serotiny and resprouting aren't enabled, // the seeding algorithm to be called with all species. SetList(expectedSpecies, spp[0], spp[1], spp[2], spp[3], spp[4], spp[5], spp[6], spp[7], spp[8], spp[9]); SetList(speciesThatReproduce, spp[3], spp[6], spp[9]); } Reproduction.Do(activeSite); Assert.AreEqual(expectedSpecies, actualSpecies_SeedingAlg); Assert.AreEqual(speciesThatReproduce, actualSpecies_AddNewCohort); } }
public void Planting() { // For readability Species.IDataset spp = core.Species; ISpecies[] speciesToPlant = new ISpecies[] { spp[1], spp[4], spp[8] }; Planting.SpeciesList plantingSpeciesList = new Planting.SpeciesList(speciesToPlant, core.Species); foreach (ActiveSite activeSite in landscape) { Reproduction.ScheduleForPlanting(plantingSpeciesList, activeSite); } // Don't expected seeding algorithm to be called since each active // set will be planted expectedSpecies.Clear(); foreach (ActiveSite activeSite in landscape) { expectedSite = activeSite; actualSpecies_SeedingAlg.Clear(); actualSpecies_AddNewCohort.Clear(); if (activeSite.SharesData) { if (activeSite.LocationInBlock == new Location(1, 1)) { SetList(speciesThatReproduce, speciesToPlant); } else { // At all other active sites in the block, nothing else // should reproduce (because first site in block had // planting occur) SetList(speciesThatReproduce); } } else { SetList(speciesThatReproduce, speciesToPlant); } Reproduction.Do(activeSite); Assert.AreEqual(expectedSpecies, actualSpecies_SeedingAlg); Assert.AreEqual(speciesThatReproduce, actualSpecies_AddNewCohort); } }