protected override void Context() { base.Context(); _protocolProperties = new ProtocolProperties(); _simulation.RemoveUsedBuildingBlock(_compound2); _compoundProperties = new CompoundProperties { Compound = new Compound().WithName(_compound2.Name), ProtocolProperties = _protocolProperties }; _simulation.Properties.AddCompoundProperties(_compoundProperties); }
protected override void Context() { _simulation = new IndividualSimulation { Properties = new SimulationProperties(), SimulationSettings = new SimulationSettings(), ModelConfiguration = new ModelConfiguration() }; _individual = new Individual().WithName("MyIndividual"); _speciesPopulation = new SpeciesPopulation(); _individual.OriginData = new OriginData { SpeciesPopulation = _speciesPopulation }; _compound = A.Fake <Compound>().WithName("MyCompound"); _protocol = A.Fake <SimpleProtocol>().WithName("MyProtocol"); _formulation = A.Fake <Formulation>().WithName("Formulation"); _simulation.AddUsedBuildingBlock(new UsedBuildingBlock("Individual", PKSimBuildingBlockType.Individual) { BuildingBlock = _individual }); _simulation.AddUsedBuildingBlock(new UsedBuildingBlock("Compound", PKSimBuildingBlockType.Compound) { BuildingBlock = _compound }); _simulation.AddUsedBuildingBlock(new UsedBuildingBlock("Protocol", PKSimBuildingBlockType.Protocol) { BuildingBlock = _protocol }); _simulation.AddUsedBuildingBlock(new UsedBuildingBlock("Formulation", PKSimBuildingBlockType.Formulation) { BuildingBlock = _formulation }); _protocolToProtocolSchemaItemMapper = A.Fake <IProtocolToSchemaItemsMapper>(); sut = new SimulationConfigurationValidator(_protocolToProtocolSchemaItemMapper); _speciesPopulation.IsHeightDependent = false; _schemaItem = A.Fake <SchemaItem>(); _doseUnit = A.Fake <Unit>(); _schemaItem.Dose.DisplayUnit = _doseUnit; _protocolProperties = new ProtocolProperties(); _formulationMapping = new FormulationMapping { FormulationKey = "F1", Formulation = _formulation }; _simulation.Properties.AddCompoundProperties(new CompoundProperties { Compound = _compound, ProtocolProperties = _protocolProperties }); A.CallTo(() => _protocolToProtocolSchemaItemMapper.MapFrom(_protocol)).Returns(new [] { _schemaItem }); }
public void EditSimulation(Simulation simulation, Compound compound) { var compoundProperties = simulation.CompoundPropertiesFor(compound); _protocolProperties = compoundProperties.ProtocolProperties; _protocol = _protocolProperties.Protocol; _simulation = simulation; _allFormulationMappingDTO = createFormulationMapping().ToList(); _view.FormulationVisible = _allFormulationMappingDTO.Any(); _view.BindTo(_allFormulationMappingDTO); _view.FormulationKeyVisible = (_allFormulationMappingDTO.Count() > 1); }
private ProtocolSelection protocolPropertiesFrom(ProtocolProperties protocolProperties, PKSimProject project) { if (protocolProperties.Protocol == null) { return(null); } return(new ProtocolSelection { Name = protocolProperties.Protocol.Name, Formulations = formulationMappingFrom(protocolProperties.FormulationMappings, project) }); }
public void EditSimulation(Simulation simulation, Compound compound) { _simulation = simulation; Compound = compound; _protocolProperties = simulation.CompoundPropertiesFor(compound).ProtocolProperties; var templateProtocol = _buildingBlockInSimulationManager.TemplateBuildingBlockUsedBy(_simulation, _protocolProperties.Protocol); _protocolSelectionDTO = new ProtocolSelectionDTO { BuildingBlock = templateProtocol }; _view.BindTo(_protocolSelectionDTO); updateActiveProtcol(); }
private void updateFormulationMapping(ProtocolProperties protocolProperties, FormulationSelection[] snapshotProtocolFormulations, PKSimProject project) { snapshotProtocolFormulations?.Each(x => { var formulation = project.BuildingBlockByName <Model.Formulation>(x.Name); var formulationMapping = new FormulationMapping { Formulation = formulation, FormulationKey = x.Key, TemplateFormulationId = formulation.Id }; protocolProperties.AddFormulationMapping(formulationMapping); }); }
protected override void Context() { base.Context(); _simulation = A.Fake <Simulation>(); _selectedProtocol = A.Fake <Protocol>(); _compound = A.Fake <Compound>(); _protocolProperties = A.Fake <ProtocolProperties>(); var compoundProperties = new CompoundProperties { ProtocolProperties = _protocolProperties }; A.CallTo(() => _simulation.CompoundPropertiesFor(_compound)).Returns(compoundProperties); sut.EditSimulation(_simulation, _compound); }
private ProtocolProperties modelProtocolPropertiesFrom(ProtocolSelection snapshotProtocol, PKSimProject project) { var protocolProperties = new ProtocolProperties(); if (snapshotProtocol == null) { return(protocolProperties); } var protocol = project.BuildingBlockByName <Model.Protocol>(snapshotProtocol.Name); protocolProperties.Protocol = protocol; updateFormulationMapping(protocolProperties, snapshotProtocol.Formulations, project); return(protocolProperties); }
protected override void Context() { _view = A.Fake <ISimulationCompoundProtocolFormulationView>(); _formulationTask = A.Fake <IFormulationTask>(); _formulationMappingMapper = A.Fake <IFormulationMappingDTOToFormulationMappingMapper>(); _formulationFromMappingRetriever = A.Fake <IFormulationFromMappingRetriever>(); _formulation1 = new Formulation(); _formulation2 = new Formulation(); _protocol = A.Fake <Protocol>(); _compound = A.Fake <Compound>(); _simulation = A.Fake <Simulation>(); _protocolProperties = A.Fake <ProtocolProperties>(); var compoundProperties = new CompoundProperties(); A.CallTo(() => _simulation.CompoundPropertiesFor(_compound)).Returns(compoundProperties); compoundProperties.ProtocolProperties = _protocolProperties; _protocolProperties.Protocol = _protocol; A.CallTo(() => _formulationTask.All()).Returns(new[] { _formulation1, _formulation2 }); _buildingBlockSelectionDisplayer = A.Fake <IBuildingBlockSelectionDisplayer>(); sut = new SimulationCompoundProtocolFormulationPresenter(_view, _formulationTask, _formulationMappingMapper, _formulationFromMappingRetriever, _buildingBlockSelectionDisplayer); }