public void Disturbed() { SimpleCore core = new SimpleCore(); core.Species = new Species.Dataset(null); core.Landscape = DisturbedSites.MixedLandscape; core.SuccessionCohorts = new MyCohorts(); const int successionTimestep = 10; MySuccession succession = new MySuccession(successionTimestep); succession.Initialize(core); // Assert that no sites are flagged as disturbed before Run() foreach (Site site in DisturbedSites.MixedLandscape.AllSites) Assert.IsFalse(succession.Disturbed[site]); foreach (Location location in DisturbedSites.Locations) { ActiveSite site = DisturbedSites.MixedLandscape[location]; succession.Disturbed[site] = true; } core.CurrentTime = successionTimestep + 1; succession.Run(); AssertAreEqual(DisturbedSites.Locations, succession.SitesVisited.ToArray()); // Confirm that the Disturbed site variable has been reset at end // of the Run() method. foreach (Site site in DisturbedSites.MixedLandscape.AllSites) Assert.IsFalse(succession.Disturbed[site]); }
public void Init() { core = new SimpleCore(); core.Species = CreateSpeciesDataset(); List<Ecoregions.IParameters> ecoregionParms = new List<Ecoregions.IParameters>(); ecoregionParms.Add(new Ecoregions.Parameters("Ecoregion A", // Name "ecoregion A", // Description 1, // Map Code, true)); // Is Active? ecoregionParms.Add(new Ecoregions.Parameters("Ecoregion D", // Name "ecoregion D", // Description 2, // Map Code, true)); // Is Active? core.Ecoregions = new Ecoregions.Dataset(ecoregionParms); int A = core.Ecoregions[0].MapCode; int D = core.Ecoregions[1].MapCode; int i = -1; // inactive ecoregion DataGrid<EcoregionCode> ecoregionGrid = new DataGrid<EcoregionCode>( Data.MakeEcoregionCodes(new int[,]{ //1 2 { A,A }, // 1 { A,A }, // 2 { A,A }, // 3 { A,D }, // 4 { i,D }, // 5 { D,i } // 6 })); landscape = new Landscape(ecoregionGrid, blockSize); core.Landscape = landscape; core.Ecoregion = landscape.NewSiteVar<IEcoregion>(); foreach (ActiveSite activeSite in landscape) { ushort mapCode = (ushort) (ecoregionGrid[activeSite.Location]); core.Ecoregion[activeSite] = core.Ecoregions.Find(mapCode); } // Reproduction.Initialize method accesses the succession // plug-in's via the age-cohort interfaces. So to avoid an // exception, we just create an empty landscape cohorts object. core.SuccessionCohorts = new AgeCohort.LandscapeCohorts(null); MockSuccession mockSuccessionPlugIn = new MockSuccession(core); expectedSpecies = new List<ISpecies>(core.Species.Count); speciesThatReproduce = new List<ISpecies>(core.Species.Count); actualSpecies_SeedingAlg = new List<ISpecies>(core.Species.Count); actualSpecies_AddNewCohort = new List<ISpecies>(core.Species.Count); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); //Entry point for simple wpf var core = new SimpleCore(); core.Startup(new AppViewModel(), new LocationViewModel(), true); //Multiple ways to load templates var templateManager = new DataTemplateManager(); templateManager.LoadDataTemplatesByConvention(); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); SimpleCore core = new SimpleCore(); var appVm = new AppViewModel(); var redVm = new RedViewModel(); core.Startup(appVm, redVm, true); DataTemplateManager manager = new DataTemplateManager(); manager.LoadDataTemplatesByConvention(); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); SimpleCore core = new SimpleCore(); core.Startup(new AppViewModel(), null, true); //Load Templates based on naming convention //EX: 'RedViewModel' will be paired with 'RedView' SimpleDataTemplateManager manager = new SimpleDataTemplateManager(); manager.LoadDataTemplatesByConvention(); //Alternative would be to manually pair types //This would idealy be used if you do not follow //the naming conventions 'View' and 'ViewModel' //manager.RegisterDataTemplate<RedViewModel, RedView>(); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); SimpleCore core = new SimpleCore(); //The 2nd and 3rd parameters are optional. //2nd: Sets a default viewmodel. //3rd: Force auto-navigate to default on startup. core.Startup(new AppViewModel(), new BlueViewModel(), true); //Load Templates based on naming convention //EX: 'RedViewModel' will be paired with 'RedView' SimpleDataTemplateManager manager = new SimpleDataTemplateManager(); manager.LoadDataTemplatesByConvention(); //Alternative would be to manually pair types //This would idealy be used if you do not follow //the naming conventions 'View' and 'ViewModel' //manager.RegisterDataTemplate<RedViewModel, RedView>(); }