public SimulationRepository(IModelConstructor modelConstructor, ModelHelperForSpecs modelHelper, IEntityPathResolver entityPathResolver, IProjectRetriever projectRetriever, IDimensionFactory dimensionFactory) { _modelConstructor = modelConstructor; _modelHelper = modelHelper; _entityPathResolver = entityPathResolver; _projectRetriever = projectRetriever; _dimensionFactory = dimensionFactory; _simulation = createSimulation(); }
private TestSimulation createSimulation() { var buildConfiguration = _modelHelper.CreateBuildConfiguration(); var result = _modelConstructor.CreateModelFrom(buildConfiguration, "Test"); var simulation = new TestSimulation { BuildConfiguration = buildConfiguration, Model = result.Model, Name = "Test" }; var allPersistable = simulation.All <IQuantity>().Where(x => x.Persistable).ToList(); var amounts = allPersistable.Where(x => x.Dimension.Name == Constants.Dimension.AMOUNT).Take(3).ToList(); amounts.Each(x => simulation.OutputSelections.AddOutput(new QuantitySelection(_entityPathResolver.PathFor(x), QuantityType.Molecule))); var firstFraction = allPersistable.First(x => x.Dimension.Name == Constants.Dimension.FRACTION); simulation.OutputSelections.AddOutput(new QuantitySelection(_entityPathResolver.PathFor(firstFraction), QuantityType.Molecule)); amounts.Each(x => _projectRetriever.CurrentProject.AddObservedData(observedDataFor(x))); _projectRetriever.CurrentProject.AddObservedData(observedDataFor(firstFraction)); return(simulation); }