protected override void Context()
        {
            _speciesRepository        = A.Fake <ISpeciesRepository>();
            _usedMoleculeRepository   = A.Fake <IUsedMoleculeRepository>();
            _projectRetriever         = A.Fake <IPKSimProjectRetriever>();
            _moleculePropertiesMapper = A.Fake <IMoleculePropertiesMapper>();
            _usedExpressionProfileCategoryRepository = A.Fake <IUsedExpressionProfileCategoryRepository>();
            sut = new ExpressionProfileToExpressionProfileDTOMapper(
                _speciesRepository,
                _usedMoleculeRepository,
                _projectRetriever,
                _moleculePropertiesMapper,
                _usedExpressionProfileCategoryRepository);

            A.CallTo(() => _usedMoleculeRepository.All()).Returns(new[] { "A", "B" });
            A.CallTo(() => _usedExpressionProfileCategoryRepository.All()).Returns(new[] { "CatA", "CatB" });
            A.CallTo(() => _speciesRepository.All()).Returns(new[] { new Species {
                                                                         Name = "Human"
                                                                     }, new Species {
                                                                         Name = "Rat"
                                                                     } });

            _expressionProfile1 = DomainHelperForSpecs.CreateExpressionProfile <IndividualEnzyme>("DOG", "CYP3A4", "Sick");

            A.CallTo(() => _projectRetriever.Current.All <ExpressionProfile>()).Returns(new[] { _expressionProfile1 });
        }
        public ExpressionProfile Create(Type moleculeType, Species species, string moleculeName)
        {
            var expressionProfile = _objectBaseFactory.Create <ExpressionProfile>();

            expressionProfile.IsLoaded = true;
            expressionProfile.Category = _usedExpressionProfileCategoryRepository.All().FirstOrDefault();
            updateSpecies(expressionProfile, species, moleculeType, moleculeName);
            return(expressionProfile);
        }
Exemple #3
0
        public ExpressionProfileDTO MapFrom(ExpressionProfile expressionProfile)
        {
            var dto = new ExpressionProfileDTO
            {
                Icon          = _moleculePropertiesMapper.MoleculeIconFor(expressionProfile.Molecule),
                Species       = expressionProfile.Species,
                Category      = expressionProfile.Category,
                MoleculeName  = moleculeNameFor(expressionProfile),
                AllMolecules  = _usedMoleculeRepository.All(),
                AllCategories = _usedExpressionProfileCategoryRepository.All(),
                AllSpecies    = _speciesRepository.All(),
                MoleculeType  = _moleculePropertiesMapper.MoleculeDisplayFor(expressionProfile.Molecule),
            };

            dto.AddExistingExpressionProfileNames(_projectRetriever.Current.All <ExpressionProfile>().AllNames().Except(new[] { expressionProfile.Name }));
            return(dto);
        }