protected override void Context() { _context = A.Fake <IExecutionContext>(); _schema = new Schema(); _protocol = new AdvancedProtocol(); sut = new AddSchemaToProtocolCommand(_schema, _protocol, _context); }
protected override void Context() { base.Context(); _protocolToEdit = new AdvancedProtocol().WithId("toto"); _newProtocol = new SimpleProtocol().WithId("tata"); sut.Edit(_protocolToEdit); }
public void Visit(AdvancedProtocol protocol) { _metaData = new ProtocolMetaData { ProtocolMode = ProtocolMode.Advanced }; serializeContentFor(protocol); }
public override void EditProtocol(Protocol protocol) { _protocol = protocol.DowncastTo <AdvancedProtocol>(); _allSchemas = new NotifyList <SchemaDTO>(_protocol.AllSchemas.MapAllUsing(_schemaDTOMapper).ToList()); _view.BindToProperties(_protocol); _view.BindToSchemas(_allSchemas); }
private async Task <SnapshotProtocol> createSnapshotFromAdvancedProtocol(AdvancedProtocol advancedProtocol) { var snapshot = await SnapshotFrom(advancedProtocol, x => { x.TimeUnit = advancedProtocol.TimeUnit.Name; }); snapshot.Schemas = await _schemaMapper.MapToSnapshots(advancedProtocol.AllSchemas); return(snapshot); }
protected override void Context() { base.Context(); _protocol = new AdvancedProtocol(); A.CallTo(() => _schemaFactory.CreateWithDefaultItem(ApplicationTypes.IntravenousBolus, _protocol)).Returns(A.Fake <Schema>()); A.CallTo(() => _objectBaseFactory.Create <AdvancedProtocol>()).Returns(_protocol); A.CallTo(() => _objectBaseFactory.Create <IRootContainer>()).Returns(new RootContainer()); }
public IPKSimCommand RemoveSchemaFrom(Schema schemaToRemove, AdvancedProtocol protocol) { if (protocol.AllSchemas.Count() <= 1) { throw new CannotDeleteSchemaException(); } return(new RemoveSchemaFromProtocolCommand(schemaToRemove, protocol, _executionContext).Run(_executionContext)); }
public override void GlobalContext() { base.GlobalContext(); LoadProject("IsDefaultConversion_722"); _compound = First <Compound>(); _formulation = First <Formulation>(); _event = First <PKSimEvent>(); _simpleProtocol = First <SimpleProtocol>(); _advancedProtocol = First <AdvancedProtocol>(); _tubularSecretionProcess = _compound.AllProcesses().FirstOrDefault(); }
protected override void Context() { _advancedProtocol = A.Fake <AdvancedProtocol>(); _allSchemas = new List <Schema>(); A.CallTo(() => _advancedProtocol.AllSchemas).Returns(_allSchemas); _schemaDTOMapper = A.Fake <ISchemaToSchemaDTOMapper>(); _schemaItemDTOMapper = A.Fake <ISchemaItemToSchemaItemDTOMapper>(); _parameterDTOMapper = A.Fake <IParameterToParameterDTOMapper>(); _protocolTask = A.Fake <IProtocolTask>(); _parameterTask = A.Fake <IParameterTask>(); _view = A.Fake <IAdvancedProtocolView>(); _dimensionRepository = A.Fake <IDimensionRepository>(); _individualFactory = A.Fake <IIndividualFactory>(); _representationInfoRepository = A.Fake <IRepresentationInfoRepository>(); sut = new AdvancedProtocolPresenter(_view, _schemaItemDTOMapper, _schemaDTOMapper, _parameterDTOMapper, _protocolTask, _parameterTask, _dimensionRepository, _individualFactory, _representationInfoRepository); sut.InitializeWith(A.Fake <ICommandCollector>()); }
protected override Task Context() { _parameterMapper = A.Fake <ParameterMapper>(); _schemaMapper = A.Fake <SchemaMapper>(); _protocolFactory = A.Fake <IProtocolFactory>(); _dimensionRepository = A.Fake <IDimensionRepository>(); sut = new ProtocolMapper(_parameterMapper, _protocolFactory, _schemaMapper, _dimensionRepository); _simpleProtocol = new SimpleProtocol { ApplicationType = ApplicationTypes.Intravenous, DosingInterval = DosingIntervals.DI_6_6_12, Name = "Simple Protocol", Description = "Simple Protocol description", }; _simpleProtocol.Add(DomainHelperForSpecs.ConstantParameterWithValue(3).WithName(Constants.Parameters.START_TIME)); _simpleProtocol.Add(DomainHelperForSpecs.ConstantParameterWithValue(4).WithName(CoreConstants.Parameters.INPUT_DOSE)); _simpleProtocol.Add(DomainHelperForSpecs.ConstantParameterWithValue(5).WithName(Constants.Parameters.END_TIME)); A.CallTo(() => _parameterMapper.MapToSnapshot(_simpleProtocol.StartTime)).Returns(new Parameter().WithName(_simpleProtocol.StartTime.Name)); A.CallTo(() => _parameterMapper.MapToSnapshot(_simpleProtocol.Dose)).Returns(new Parameter().WithName(_simpleProtocol.Dose.Name)); A.CallTo(() => _parameterMapper.MapToSnapshot(_simpleProtocol.EndTimeParameter)).Returns(new Parameter().WithName(_simpleProtocol.EndTimeParameter.Name)); _advancedProtocol = new AdvancedProtocol { Name = "Advanced Protocol", Description = "Advanced Protocol description", TimeUnit = DomainHelperForSpecs.TimeDimensionForSpecs().DefaultUnit, }; _schema = new Schema().WithName("Schema1"); _advancedProtocol.AddSchema(_schema); _advancedProtocolParameter = DomainHelperForSpecs.ConstantParameterWithValue(3).WithName("AdvancedProtocolParameter"); _advancedProtocol.Add(_advancedProtocolParameter); A.CallTo(() => _parameterMapper.MapToSnapshot(_advancedProtocolParameter)).Returns(new Parameter().WithName(_advancedProtocolParameter.Name)); _snapshotSchema = new Snapshots.Schema().WithName(_schema.Name); A.CallTo(() => _schemaMapper.MapToSnapshot(_schema)).Returns(_snapshotSchema); A.CallTo(() => _dimensionRepository.Time).Returns(DomainHelperForSpecs.TimeDimensionForSpecs()); return(Task.FromResult(true)); }
protected override void Context() { base.Context(); _sourceProtocol = new SimpleProtocol { Id = "Id", Name = "Simple Protocol", Description = "tralala" }; _sourceProtocol.Add(DomainHelperForSpecs.ConstantParameterWithValue(1).WithName("SimpleParameter")); _targetProtocol = new AdvancedProtocol { DomainHelperForSpecs.ConstantParameterWithValue(1).WithName(name: "AdvancedParameter") }; _schema1 = new Schema { Name = "Schema1" }; _schema2 = new Schema { Name = "Schema2" }; _oldSchema = new Schema { Name = "_oldSchema" }; _targetProtocol.AddSchema(_oldSchema); A.CallTo(() => _schemaMapper.MapFrom(_sourceProtocol)).Returns(new[] { _schema1, _schema2 }); }
public IPKSimCommand AddSchemaTo(AdvancedProtocol protocol) { var newSchema = _schemaFactory.CreateWithDefaultItem(ApplicationTypes.IntravenousBolus, protocol); return(new AddSchemaToProtocolCommand(newSchema, protocol, _executionContext).Run(_executionContext)); }
public void Visit(AdvancedProtocol advancedProtocol) { advancedProtocol.AllSchemas.SelectMany(x => x.SchemaItems).Each(convertSchemaItem); _converted = true; }
public IPKSimCommand RemoveSchemaFrom(Schema schemaToDelete, AdvancedProtocol protocol) { return(_schemaTask.RemoveSchemaFrom(schemaToDelete, protocol)); }
protected override void Context() { base.Context(); _protocolToEdit = new AdvancedProtocol(); }
public void Visit(AdvancedProtocol protocol) { adjustDefaultStateOfAllParametersIn(protocol); protocol.AllSchemas.Each(convertSchema); }
public void Visit(AdvancedProtocol advancedProtocol) { performCommonConversion(advancedProtocol); }
protected override async Task Because() { _newProtocol = (await sut.MapToModel(_snapshot, new SnapshotContext())).DowncastTo <AdvancedProtocol>(); }
public void BindToProperties(AdvancedProtocol advancedProtocol) { _screenBinder.BindToSource(advancedProtocol); }
public IPKSimCommand AddSchemaTo(AdvancedProtocol protocol) { return(_schemaTask.AddSchemaTo(protocol)); }