protected override async Task Context() { await base.Context(); _snapshot = await sut.MapToSnapshot(_compoundProperties, _project); // Adds an incorrect compound process selection _snapshot.Processes = new List <CompoundProcessSelection>(_snapshot.Processes) { new CompoundProcessSelection() }.ToArray(); _simulation = A.Fake <Simulation>(); _simulationSubject = A.Fake <ISimulationSubject>(); A.CallTo(() => _simulationSubject.MoleculeByName("CYP3A4")).Returns(new IndividualEnzyme { Name = "CYP3A4" }); A.CallTo(() => _simulation.BuildingBlock <ISimulationSubject>()).Returns(_simulationSubject); var newModelCompoundProperties = new Model.CompoundProperties { Compound = _compoundProperties.Compound }; _compoundProperties.CompoundGroupSelections.Each(newModelCompoundProperties.AddCompoundGroupSelection); A.CallTo(() => _simulation.CompoundPropertiesFor(_snapshot.Name)).Returns(newModelCompoundProperties); _context = new CompoundPropertiesContext(_project, _simulation); }
protected override async Task Context() { await base.Context(); _snapshot = await sut.MapToSnapshot(_compoundProperties, _project); _simulation = A.Fake <Simulation>(); var newModelCompoundProperties = new Model.CompoundProperties { Compound = _compoundProperties.Compound }; _compoundProperties.CompoundGroupSelections.Each(newModelCompoundProperties.AddCompoundGroupSelection); A.CallTo(() => _simulation.CompoundPropertiesFor(_snapshot.Name)).Returns(newModelCompoundProperties); _context = new CompoundPropertiesContext(_project, _simulation); }
protected override async Task Context() { await base.Context(); _snapshot = await sut.MapToSnapshot(_compoundProperties, _project); _simulation = A.Fake <Simulation>(); var newModelCompoundProperties = new Model.CompoundProperties { Compound = _compoundProperties.Compound }; _compoundProperties.CompoundGroupSelections.Each(newModelCompoundProperties.AddCompoundGroupSelection); A.CallTo(() => _simulation.CompoundPropertiesFor(_snapshot.Name)).Returns(newModelCompoundProperties); _context = new SnapshotContextWithSimulation(_simulation, _baseSnapshotContext); _snapshot.Alternatives[0].AlternativeName = "UNKNOWN"; }
protected override async Task Context() { await base.Context(); _snapshot = await sut.MapToSnapshot(_compoundProperties, _project); _simulation = A.Fake <Simulation>(); _simulationSubject = A.Fake <ISimulationSubject>(); A.CallTo(() => _simulationSubject.MoleculeByName("CYP3A4")).Returns(null); A.CallTo(() => _simulation.BuildingBlock <ISimulationSubject>()).Returns(_simulationSubject); var newModelCompoundProperties = new Model.CompoundProperties { Compound = _compoundProperties.Compound }; _compoundProperties.CompoundGroupSelections.Each(newModelCompoundProperties.AddCompoundGroupSelection); A.CallTo(() => _simulation.CompoundPropertiesFor(_snapshot.Name)).Returns(newModelCompoundProperties); _context = new SnapshotContextWithSimulation(_simulation, _baseSnapshotContext); }
protected override Task Context() { _calculationMethodCacheMapper = A.Fake <CalculationMethodCacheMapper>(); _processMappingMapper = A.Fake <ProcessMappingMapper>(); _logger = A.Fake <ILogger>(); _project = new PKSimProject(); _calculationMethodSnapshot = new CalculationMethodCache(); sut = new CompoundPropertiesMapper(_calculationMethodCacheMapper, _processMappingMapper, _logger); _compoundGroupSelectionOneAlternative = new CompoundGroupSelection { AlternativeName = "ALT1", GroupName = "ALTERNATIVE_GROUP_1" }; _compoundGroupSelectionTwoAlternatives = new CompoundGroupSelection { AlternativeName = "ALT2", GroupName = "ALTERNATIVE_GROUP_2" }; _compound = new Compound { Name = "COMP", }; _protocol = new SimpleProtocol { Name = "PROTOCOL" }; _parameterAlternativeGroupWithOneAlternative = new ParameterAlternativeGroup { Name = _compoundGroupSelectionOneAlternative.GroupName }; _parameterAlternativeGroupWithTwoAlternatives = new ParameterAlternativeGroup { Name = _compoundGroupSelectionTwoAlternatives.GroupName }; _parameterAlternativeGroupWithTwoAlternatives.AddAlternative(new ParameterAlternative { Name = "ALT1" }); _parameterAlternativeGroupWithTwoAlternatives.AddAlternative(new ParameterAlternative { Name = "ALT2" }); _compound.AddParameterAlternativeGroup(_parameterAlternativeGroupWithOneAlternative); _compound.AddParameterAlternativeGroup(_parameterAlternativeGroupWithTwoAlternatives); _compoundProperties = new Model.CompoundProperties(); _compoundProperties.AddCompoundGroupSelection(_compoundGroupSelectionOneAlternative); _compoundProperties.AddCompoundGroupSelection(_compoundGroupSelectionTwoAlternatives); _compoundProperties.Compound = _compound; _enzymaticProcess = new EnzymaticProcess { Name = "EnzymaticProcess" }; _anotherEnzymaticProcess = new EnzymaticProcess { Name = "AnotherEnzymaticProcess", MoleculeName = "CYP3A4" }; _specificBindingProcess = new SpecificBindingPartialProcess { Name = "SpecificBinding" }; _gfrTransportProcess = new SystemicProcess { Name = "Transport", SystemicProcessType = SystemicProcessTypes.GFR }; _hepaticEnzymaticProcess = new SystemicProcess { Name = "Plasma Clearance", SystemicProcessType = SystemicProcessTypes.Hepatic }; _compound.AddProcess(_enzymaticProcess); _compound.AddProcess(_specificBindingProcess); _compound.AddProcess(_gfrTransportProcess); _compound.AddProcess(_hepaticEnzymaticProcess); _enzymaticPartialProcessSelection = new EnzymaticProcessSelection { ProcessName = _enzymaticProcess.Name }; _noEnzymaticSystemicProcessSelection = new SystemicProcessSelection { ProcessType = SystemicProcessTypes.Hepatic }; _specificBindingPartialProcessSelection = new ProcessSelection { ProcessName = _specificBindingProcess.Name }; _transportSystemicProcessSelection = new SystemicProcessSelection { ProcessName = _gfrTransportProcess.Name, ProcessType = _gfrTransportProcess.SystemicProcessType, }; _noEnzymaticPartialProcessSelection = new EnzymaticProcessSelection { MoleculeName = _anotherEnzymaticProcess.MoleculeName }; _compoundProperties.Processes.MetabolizationSelection.AddPartialProcessSelection(_enzymaticPartialProcessSelection); _compoundProperties.Processes.MetabolizationSelection.AddPartialProcessSelection(_noEnzymaticPartialProcessSelection); _compoundProperties.Processes.MetabolizationSelection.AddSystemicProcessSelection(_noEnzymaticSystemicProcessSelection); _compoundProperties.Processes.SpecificBindingSelection.AddPartialProcessSelection(_specificBindingPartialProcessSelection); _compoundProperties.Processes.TransportAndExcretionSelection.AddSystemicProcessSelection(_transportSystemicProcessSelection); _snapshotProcess1 = new CompoundProcessSelection { Name = _enzymaticPartialProcessSelection.ProcessName }; _snapshotProcess2 = new CompoundProcessSelection { Name = _specificBindingPartialProcessSelection.ProcessName }; _snapshotProcess3 = new CompoundProcessSelection { Name = _transportSystemicProcessSelection.ProcessName }; _snapshotProcess4 = new CompoundProcessSelection { SystemicProcessType = _noEnzymaticSystemicProcessSelection.ProcessType.SystemicProcessTypeId.ToString() }; _snapshotProcess5 = new CompoundProcessSelection { MoleculeName = _noEnzymaticPartialProcessSelection.MoleculeName }; _formulation = new Formulation { Id = "123456" }; _compoundProperties.ProtocolProperties.Protocol = _protocol; _compoundProperties.ProtocolProperties.AddFormulationMapping(new FormulationMapping { FormulationKey = "F1", TemplateFormulationId = _formulation.Id }); _project.AddBuildingBlock(_formulation); A.CallTo(() => _calculationMethodCacheMapper.MapToSnapshot(_compoundProperties.CalculationMethodCache)).Returns(_calculationMethodSnapshot); A.CallTo(() => _processMappingMapper.MapToSnapshot(_enzymaticPartialProcessSelection)).Returns(_snapshotProcess1); A.CallTo(() => _processMappingMapper.MapToSnapshot(_specificBindingPartialProcessSelection)).Returns(_snapshotProcess2); A.CallTo(() => _processMappingMapper.MapToSnapshot(_transportSystemicProcessSelection)).Returns(_snapshotProcess3); A.CallTo(() => _processMappingMapper.MapToSnapshot(_noEnzymaticSystemicProcessSelection)).Returns(_snapshotProcess4); A.CallTo(() => _processMappingMapper.MapToSnapshot(_noEnzymaticPartialProcessSelection)).Returns(_snapshotProcess5); A.CallTo(() => _processMappingMapper.MapToModel(_snapshotProcess1, _enzymaticProcess)).Returns(_enzymaticPartialProcessSelection); A.CallTo(() => _processMappingMapper.MapToModel(_snapshotProcess2, _specificBindingProcess)).Returns(_specificBindingPartialProcessSelection); A.CallTo(() => _processMappingMapper.MapToModel(_snapshotProcess3, _gfrTransportProcess)).Returns(_transportSystemicProcessSelection); A.CallTo(() => _processMappingMapper.MapToModel(_snapshotProcess4, A <NotSelectedSystemicProcess> ._)).Returns(_noEnzymaticSystemicProcessSelection); A.CallTo(() => _processMappingMapper.MapToModel(_snapshotProcess5, A <EnzymaticProcess> ._)).Returns(_noEnzymaticPartialProcessSelection); return(_completed); }