protected override Task Context() { _parameterMapper = A.Fake <ParameterMapper>(); _formulationRepository = A.Fake <IFormulationRepository>(); _cloner = A.Fake <ICloner>(); sut = new FormulationMapper(_parameterMapper, _formulationRepository, _cloner); _parameter1 = DomainHelperForSpecs.ConstantParameterWithValue(5, isDefault: false) .WithName("Param1"); _parameter2 = DomainHelperForSpecs.ConstantParameterWithValue(5, isDefault: true) .WithName("Param2"); _hiddenParameter = DomainHelperForSpecs.ConstantParameterWithValue(5, isDefault: false) .WithName("Param3"); _hiddenParameter.Visible = false; _formulation = new Formulation { Name = "Form", FormulationType = "Weibul", Description = "Amazing formulation" }; _formulation.Add(_parameter1); _formulation.Add(_parameter2); _formulation.Add(_hiddenParameter); A.CallTo(() => _parameterMapper.MapToSnapshot(_parameter1)).Returns(new Parameter().WithName(_parameter1.Name)); A.CallTo(() => _parameterMapper.MapToSnapshot(_parameter2)).Returns(new Parameter().WithName(_parameter2.Name)); A.CallTo(() => _parameterMapper.MapToSnapshot(_hiddenParameter)).Returns(new Parameter().WithName(_hiddenParameter.Name)); return(Task.FromResult(true)); }
public void Visit(Formulation formulation) { if (!formulation.FormulationType.IsOneOf(CoreConstants.Formulation.Weibull, CoreConstants.Formulation.Lint80, CoreConstants.Formulation.Particles, CoreConstants.Formulation.Table)) { return; } var templateFormulation = _formulationRepository.FormulationBy(formulation.FormulationType); var useAsSuspension = _cloner.Clone(templateFormulation.Parameter(CoreConstants.Parameter.USE_AS_SUSPENSION)); useAsSuspension.Value = 0; formulation.Add(useAsSuspension); }
public void Visit(Formulation formulation) { if (!formulation.FormulationType.IsOneOf(CoreConstants.Formulation.WEIBULL, CoreConstants.Formulation.LINT80, CoreConstants.Formulation.TABLE)) { return; } var templateFormulation = _formulationRepository.FormulationBy(formulation.FormulationType); var useAsSuspension = _cloner.Clone(templateFormulation.Parameter(Constants.Parameters.USE_AS_SUSPENSION)); useAsSuspension.Value = 0; formulation.Add(useAsSuspension); _converted = true; }
protected override void Context() { base.Context(); _tableParameter = new PKSimParameter(); _formulation = new Formulation { FormulationType = CoreConstants.Formulation.Table }; _formulation.Add(_tableParameter); _formulationDTO = A.Fake <FormulationDTO>(); _formulationDTO.Parameters = new[] { _tableParameter }; _formulationDTO.Type = new FormulationTypeDTO { Id = "oral" }; A.CallTo(() => _formulationDTOMapper.MapFrom(_formulation)).Returns(_formulationDTO); A.CallTo(() => _tableFormulationPresenter.EditedFormula).Returns(new TableFormula()); }