示例#1
0
        private ReportPart defaultReportFor <TObject>(TObject objectToReport)
        {
            var report     = new ReportPart();
            var objectBase = objectToReport as IObjectBase;

            if (objectBase != null)
            {
                report.AddToContent(_representationInfoRepository.DescriptionFor(objectBase));
            }

            return(report);
        }
        protected override Task Context()
        {
            _parameterMapper = A.Fake <ParameterMapper>();
            _representationInfoRepository = A.Fake <IRepresentationInfoRepository>();
            _compoundProcessRepository    = A.Fake <ICompoundProcessRepository>();
            _cloner              = A.Fake <ICloner>();
            _speciesRepository   = A.Fake <ISpeciesRepository>();
            _compoundProcessTask = A.Fake <ICompoundProcessTask>();
            _logger              = A.Fake <IOSPSuiteLogger>();


            sut = new CompoundProcessMapper(_parameterMapper, _representationInfoRepository, _compoundProcessRepository, _cloner, _speciesRepository, _compoundProcessTask, _logger);

            _enzymaticProcess = new EnzymaticProcess
            {
                Name           = "Enzymatic Process",
                Description    = "Process description",
                InternalName   = "A",
                DataSource     = "B",
                MetaboliteName = "Meta"
            };

            //Same description as DB
            A.CallTo(() => _representationInfoRepository.DescriptionFor(RepresentationObjectType.PROCESS, _enzymaticProcess.InternalName)).Returns(_enzymaticProcess.Description);

            _enzymaticProcessWithSpecies = new EnzymaticProcessWithSpecies
            {
                Name         = "Enzymatic process with species",
                Description  = "toto",
                Species      = new Species().WithName("Human"),
                InternalName = "C",
                DataSource   = "D",
            };

            A.CallTo(() => _representationInfoRepository.DescriptionFor(RepresentationObjectType.PROCESS, _enzymaticProcessWithSpecies.InternalName)).Returns("Process description");

            return(Task.FromResult(true));
        }
示例#3
0
        private string descriptionFor(ModelCompoundProcess compoundProcess)
        {
            var databaseDescription = _representationInfoRepository.DescriptionFor(RepresentationObjectType.PROCESS, compoundProcess.InternalName);

            return(string.Equals(databaseDescription, compoundProcess.Description) ? null : compoundProcess.Description);
        }
示例#4
0
        private string descriptionFor(IParameter parameter)
        {
            var pkDescription = _pkParameterRepository.DescriptionFor(parameter.Name);

            return(!string.IsNullOrEmpty(pkDescription) ? pkDescription : _representationInfoRepository.DescriptionFor(parameter));
        }