//--------------------------------------------------------------------- private OldToYoungIterator CreateAndUseItor(SpeciesCohorts cohorts) { Assert.AreEqual(1, cohorts.Count); ICohort cohort = cohorts[0]; ushort initialAge = cohort.Age; int initialBiomass = cohort.Biomass; OldToYoungIterator itor = cohorts.OldToYoung; Assert.IsNotNull(itor); Assert.AreEqual(cohorts, itor.SpeciesCohorts); Assert.AreEqual(cohort.Age, itor.Age); const int initialSiteBiomass = 1234; int siteBiomass = initialSiteBiomass; const int prevYearMortality = 55; const int biomassChange = 111; mockCalculator.Change = biomassChange; mockCalculator.Mortality = 20; int mortality = itor.GrowCurrentCohort(activeSite, ref siteBiomass, prevYearMortality); Assert.AreEqual(mockCalculator.Mortality, mortality); Assert.AreEqual(1, cohorts.Count); cohort = cohorts[0]; Assert.IsNotNull(cohort); Assert.AreEqual(betualle, cohort.Species); Assert.AreEqual(initialAge + 1, cohort.Age); Assert.AreEqual(initialBiomass + biomassChange, cohort.Biomass); Assert.IsFalse(itor.MoveNext()); return(itor); }
public void Timestep1_CombineYoung_AtEnd_MoveNext() { OldToYoungIterator itor = CreateAndUseItor(CreateCohortsAndCombineYoung(1)); Assert.IsFalse(itor.MoveNext()); }
public void Timestep1_AtEnd_MoveNext() { OldToYoungIterator itor = CreateAndUseItor(1); Assert.IsFalse(itor.MoveNext()); }