예제 #1
0
 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);
 }
예제 #4
0
        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);
        }
예제 #5
0
        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);
        }
예제 #6
0
 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());
 }
예제 #7
0
        public IPKSimCommand RemoveSchemaFrom(Schema schemaToRemove, AdvancedProtocol protocol)
        {
            if (protocol.AllSchemas.Count() <= 1)
            {
                throw new CannotDeleteSchemaException();
            }

            return(new RemoveSchemaFromProtocolCommand(schemaToRemove, protocol, _executionContext).Run(_executionContext));
        }
예제 #8
0
 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));
        }
예제 #11
0
 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 });
 }
예제 #12
0
        public IPKSimCommand AddSchemaTo(AdvancedProtocol protocol)
        {
            var newSchema = _schemaFactory.CreateWithDefaultItem(ApplicationTypes.IntravenousBolus, protocol);

            return(new AddSchemaToProtocolCommand(newSchema, protocol, _executionContext).Run(_executionContext));
        }
예제 #13
0
 public void Visit(AdvancedProtocol advancedProtocol)
 {
     advancedProtocol.AllSchemas.SelectMany(x => x.SchemaItems).Each(convertSchemaItem);
     _converted = true;
 }
예제 #14
0
 public IPKSimCommand RemoveSchemaFrom(Schema schemaToDelete, AdvancedProtocol protocol)
 {
     return(_schemaTask.RemoveSchemaFrom(schemaToDelete, protocol));
 }
 protected override void Context()
 {
     base.Context();
     _protocolToEdit = new AdvancedProtocol();
 }
예제 #16
0
 public void Visit(AdvancedProtocol protocol)
 {
     adjustDefaultStateOfAllParametersIn(protocol);
     protocol.AllSchemas.Each(convertSchema);
 }
예제 #17
0
 public void Visit(AdvancedProtocol advancedProtocol)
 {
     performCommonConversion(advancedProtocol);
 }
 protected override async Task Because()
 {
     _newProtocol = (await sut.MapToModel(_snapshot, new SnapshotContext())).DowncastTo <AdvancedProtocol>();
 }
예제 #19
0
 public void BindToProperties(AdvancedProtocol advancedProtocol)
 {
     _screenBinder.BindToSource(advancedProtocol);
 }
예제 #20
0
 public IPKSimCommand AddSchemaTo(AdvancedProtocol protocol)
 {
     return(_schemaTask.AddSchemaTo(protocol));
 }