protected override Task Context() { _parameterMapper = A.Fake <ParameterMapper>(); _outputIntervalFactory = A.Fake <IOutputIntervalFactory>(); sut = new OutputIntervalMapper(_parameterMapper, _outputIntervalFactory); _outputInterval = new OutputInterval { Name = "Interval" }; _endTimeParameter = DomainHelperForSpecs.ConstantParameterWithValue(1, isDefault: true).WithName(Constants.Parameters.END_TIME); _resolutionParameter = DomainHelperForSpecs.ConstantParameterWithValue(1, isDefault: true).WithName(Constants.Parameters.RESOLUTION); _anotherParameter = DomainHelperForSpecs.ConstantParameterWithValue(1, isDefault: false).WithName("Another"); _outputInterval.Add(_endTimeParameter); _outputInterval.Add(_anotherParameter); _outputInterval.Add(_resolutionParameter); _endTimeSnapshotParameter = new Parameter().WithName(_endTimeParameter.Name); _anotherSnapshotParameter = new Parameter().WithName(_anotherParameter.Name); _resolutionSnapshotParameter = new Parameter().WithName(_resolutionParameter.Name); A.CallTo(() => _parameterMapper.MapToSnapshot(_endTimeParameter)).Returns(_endTimeSnapshotParameter); A.CallTo(() => _parameterMapper.MapToSnapshot(_anotherParameter)).Returns(_anotherSnapshotParameter); A.CallTo(() => _parameterMapper.MapToSnapshot(_resolutionParameter)).Returns(_resolutionSnapshotParameter); return(_completed); }
protected override void Context() { base.Context(); _defaultInterval = new OutputInterval(); A.CallTo(() => _outputIntervalFactory.CreateDefault()).Returns(_defaultInterval); _time = A.Fake <IDimension>(); A.CallTo(() => _time.Name).Returns(Constants.Dimension.TIME); _resolution = A.Fake <IDimension>(); A.CallTo(() => _resolution.Name).Returns(Constants.Dimension.RESOLUTION); _startTimeParameter = new PKSimParameter().WithName(Constants.Parameters.START_TIME).WithDimension(_time); _endTimeParameter = new PKSimParameter().WithName(Constants.Parameters.END_TIME).WithDimension(_time); _numberOfTimePointParameter = new PKSimParameter().WithName(Constants.Parameters.RESOLUTION).WithDimension(_resolution); _defaultInterval.Add(_startTimeParameter); _defaultInterval.Add(_endTimeParameter); _defaultInterval.Add(_numberOfTimePointParameter); }
public void TestSerialization() { var schema = new OutputSchema(); var interval = new OutputInterval(); var quantitySelection = new OutputSelections(); var solverSettingsFactory = IoC.Resolve <ISolverSettingsFactory>(); var x1 = new SimulationSettings { Solver = solverSettingsFactory.CreateCVODE(), OutputSchema = schema, OutputSelections = quantitySelection }; interval.Add(CreateObject <Parameter>().WithName(Constants.Parameters.START_TIME).WithFormula(new ConstantFormula(0))); interval.Add(CreateObject <Parameter>().WithName(Constants.Parameters.END_TIME).WithFormula(new ConstantFormula(1440))); interval.Add(CreateObject <Parameter>().WithName(Constants.Parameters.RESOLUTION).WithFormula(new ConstantFormula(240))); quantitySelection.AddOutput(new QuantitySelection("A|B|C", QuantityType.Protein)); quantitySelection.AddOutput(new QuantitySelection("A|B", QuantityType.Enzyme)); var x2 = SerializeAndDeserialize(x1); AssertForSpecs.AreEqualSimulationSettings(x2, x1); }