public SpeciesContainerQuery(IFlatPopulationContainerRepository populationContainerRepository,
                              IFlatContainerRepository flatContainerRepository,
                              IFlatContainerIdToContainerMapper containerMapper,
                              IEntityPathResolver entityPathResolver)
 {
     _populationContainerRepository = populationContainerRepository;
     _flatContainerRepository       = flatContainerRepository;
     _containerMapper    = containerMapper;
     _entityPathResolver = entityPathResolver;
 }
 public ModelContainerQuery(IFlatModelContainerRepository modelContainerRepo,
                            IFlatPopulationContainerRepository populationContainerRepo,
                            IFlatContainerRepository flatContainerRepo,
                            IFlatContainerIdToContainerMapper flatContainerIdToContainerMapper,
                            IEntityPathResolver entityPathResolver)
 {
     _modelContainerRepo               = modelContainerRepo;
     _populationContainerRepo          = populationContainerRepo;
     _flatContainerRepo                = flatContainerRepo;
     _flatContainerIdToContainerMapper = flatContainerIdToContainerMapper;
     _entityPathResolver               = entityPathResolver;
 }
Beispiel #3
0
        protected override void Context()
        {
            _entityPathResolver = new EntityPathResolver(new ObjectPathFactoryForSpecs());
            _flatContainerIdToContainerMapper = A.Fake <IFlatContainerIdToContainerMapper>();
            _modelContainerRepo = A.Fake <IFlatModelContainerRepository>();
            _compartment        = A.Fake <IContainer>();
            _populationName     = "HUMAN_POP";

            A.CallTo(() => _modelContainerRepo.All()).Returns(
                new List <FlatModelContainer>
            {
                NewFMC(1, "C1", "ORGAN", "M1"),
                NewFMC(2, "C2", "COMPARTMENT", "M1"),
                NewFMC(3, Constants.ROOT, "SIMULATION", "M1")
            });

            _populationContainerRepo = A.Fake <IFlatPopulationContainerRepository>();
            A.CallTo(() => _populationContainerRepo.AllSubContainerFor(_populationName, 3)).Returns(
                new List <FlatPopulationContainer>
            {
                CreateFlatPopulationContainer(1, "C1", "ORGAN", _populationName),
            });

            A.CallTo(() => _populationContainerRepo.AllSubContainerFor(_populationName, 1)).Returns(
                new List <FlatPopulationContainer>
            {
                CreateFlatPopulationContainer(2, "C2", "COMPARTMENT", _populationName)
            });


            _flatContainerRepo = A.Fake <IFlatContainerRepository>();
            var simulationFlatContainer  = NewFC(3, Constants.ROOT, "SIMULATION", null, "", "");
            var organFlatContainer       = NewFC(1, "C1", "ORGAN", 3, "SIMULATION", Constants.ROOT);
            var compartmentFlatContainer = NewFC(2, "C2", "COMPARTMENT", 1, "C1", "ORGAN");

            A.CallTo(() => _flatContainerRepo.All()).Returns(
                new List <FlatContainer>
            {
                organFlatContainer,
                compartmentFlatContainer,
                simulationFlatContainer
            });

            A.CallTo(() => _flatContainerRepo.ParentContainerFrom(organFlatContainer.Id)).Returns(simulationFlatContainer);
            A.CallTo(() => _flatContainerRepo.ParentContainerFrom(compartmentFlatContainer.Id)).Returns(organFlatContainer);
            A.CallTo(() => _flatContainerRepo.ParentContainerFrom(simulationFlatContainer.Id)).Returns(null);

            A.CallTo(() => _flatContainerRepo.ContainerFrom(organFlatContainer.Id)).Returns(organFlatContainer);
            A.CallTo(() => _flatContainerRepo.ContainerFrom(compartmentFlatContainer.Id)).Returns(compartmentFlatContainer);
            A.CallTo(() => _flatContainerRepo.ContainerFrom(simulationFlatContainer.Id)).Returns(simulationFlatContainer);

            _flatModelCompartment = new FlatModelContainer {
                Id = compartmentFlatContainer.Id
            };
            A.CallTo(() => _flatContainerRepo.ContainerFrom("ROOT")).Returns(organFlatContainer);
            A.CallTo(() => _flatContainerRepo.ContainerFrom("C1")).Returns(organFlatContainer);

            A.CallTo(() => _modelContainerRepo.AllSubContainerFor("M1", 1)).Returns(new[] { _flatModelCompartment });
            A.CallTo(() => _flatContainerIdToContainerMapper.MapFrom(_flatModelCompartment)).Returns(_compartment);
            sut = new ModelContainerQuery(_modelContainerRepo, _populationContainerRepo,
                                          _flatContainerRepo, _flatContainerIdToContainerMapper, _entityPathResolver);
        }