Exemplo n.º 1
0
 public ModelContainerQuery(IFlatModelContainerRepository modelContainerRepo,
                            IFlatSpeciesContainerRepository speciesContainerRepo,
                            IFlatContainerRepository flatContainerRepo,
                            IFlatContainerIdToContainerMapper flatContainerIdToContainerMapper,
                            IEntityPathResolver entityPathResolver)
 {
     _modelContainerRepo               = modelContainerRepo;
     _speciesContainerRepo             = speciesContainerRepo;
     _flatContainerRepo                = flatContainerRepo;
     _flatContainerIdToContainerMapper = flatContainerIdToContainerMapper;
     _entityPathResolver               = entityPathResolver;
 }
 public ModelContainerQuery(IFlatModelContainerRepository modelContainerRepo,
                            IFlatPopulationContainerRepository populationContainerRepo,
                            IFlatContainerRepository flatContainerRepo,
                            IFlatContainerIdToContainerMapper flatContainerIdToContainerMapper,
                            IEntityPathResolver entityPathResolver)
 {
     _modelContainerRepo               = modelContainerRepo;
     _populationContainerRepo          = populationContainerRepo;
     _flatContainerRepo                = flatContainerRepo;
     _flatContainerIdToContainerMapper = flatContainerIdToContainerMapper;
     _entityPathResolver               = entityPathResolver;
 }
 protected override void Context()
 {
     base.Context();
     _neighborhoodRepository                       = A.Fake <IFlatNeighborhoodRepository>();
     _modelContainerRepository                     = A.Fake <IFlatModelContainerRepository>();
     _neighborhoodBuilderFactory                   = A.Fake <INeighborhoodBuilderFactory>();
     _modelProperties                              = A.Fake <ModelProperties>();
     _modelProperties.ModelConfiguration           = A.Fake <ModelConfiguration>();
     _modelProperties.ModelConfiguration.ModelName = "3Comp";
     _allFlatNeighborhoods                         = new List <FlatModelContainer>();
     A.CallTo(() => _modelContainerRepository.All()).Returns(_allFlatNeighborhoods);
     _flatNeighborhoodFor3Comp = new FlatModelContainer {
         Model = "3Comp", Type = CoreConstants.ContainerType.NEIGHBORHOOD, Id = 1
     };
     _flatNeighborhoodFor4Comp = new FlatModelContainer {
         Model = "4Comp", Type = CoreConstants.ContainerType.NEIGHBORHOOD, Id = 2
     };
     _allFlatNeighborhoods.Add(_flatNeighborhoodFor3Comp);
     _allFlatNeighborhoods.Add(_flatNeighborhoodFor4Comp);
     sut = new ModelNeighborhoodQuery(_modelContainerRepository, _neighborhoodBuilderFactory);
 }
 public ModelNeighborhoodQuery(IFlatModelContainerRepository modelContainerRepository, INeighborhoodBuilderFactory neighborhoodBuilderFactory)
 {
     _modelContainerRepository   = modelContainerRepository;
     _neighborhoodBuilderFactory = neighborhoodBuilderFactory;
 }
Exemplo n.º 5
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);
        }