예제 #1
0
        protected override void Context()
        {
            _objectBaseFactory         = A.Fake <IObjectBaseFactory>();
            _rateObjectPathsRepository = A.Fake <IRateObjectPathsRepository>();
            _rateFormulaRepository     = A.Fake <IRateFormulaRepository>();
            _distributionFactory       = A.Fake <IDistributionFormulaFactory>();
            _dimensionRepository       = A.Fake <IDimensionRepository>();
            _timeDimension             = A.Fake <IDimension>();
            _idGenerator = A.Fake <IIdGenerator>();
            A.CallTo(() => _objectBaseFactory.Create <ExplicitFormula>()).Returns(new ExplicitFormula());
            A.CallTo(() => _objectBaseFactory.Create <ConstantFormula>()).Returns(new ConstantFormula());
            A.CallTo(() => _objectBaseFactory.Create <SumFormula>()).Returns(new SumFormula());
            A.CallTo(() => _dimensionRepository.Time).Returns(_timeDimension);
            _objectPathFactory          = new ObjectPathFactoryForSpecs();
            _dynamicFormulaCriteriaRepo = A.Fake <IDynamicFormulaCriteriaRepository>();

            _dynamicSumFormulaRateKey = new RateKey(CoreConstants.CalculationMethod.DynamicSumFormulas, "SomeFormula");

            _sumFormulaCriteria = new DescriptorCriteria();
            _sumFormulaCriteria.Add(new MatchTagCondition("xxx"));
            _sumFormulaCriteria.Add(new NotMatchTagCondition("yyy"));

            A.CallTo(() => _dynamicFormulaCriteriaRepo.CriteriaFor(_dynamicSumFormulaRateKey)).Returns(_sumFormulaCriteria);
            A.CallTo(() => _rateFormulaRepository.FormulaFor(_dynamicSumFormulaRateKey)).Returns("P_#i");
            sut = new FormulaFactory(_objectBaseFactory, _rateObjectPathsRepository, _rateFormulaRepository, _distributionFactory,
                                     _objectPathFactory, _dimensionRepository, _idGenerator, _dynamicFormulaCriteriaRepo);
        }
 public override void GlobalContext()
 {
     base.GlobalContext();
     _parameterValueRepository        = IoC.Resolve <IParameterValueRepository>();
     _parameterRateRepository         = IoC.Resolve <IParameterRateRepository>();
     _speciesRepository               = IoC.Resolve <ISpeciesRepository>();
     _calculationMethodRepository     = IoC.Resolve <ICalculationMethodRepository>();
     _rateFormulaRepository           = IoC.Resolve <IRateFormulaRepository>();
     _rateObjectPathsRepository       = IoC.Resolve <IRateObjectPathsRepository>();
     _parameterDistributionRepository = IoC.Resolve <IParameterDistributionRepository>();
 }
예제 #3
0
 public FormulaFactory(IObjectBaseFactory objectBaseFactory, IRateObjectPathsRepository rateObjectPathsRepository,
                       IRateFormulaRepository rateFormulaRepository, IDistributionFormulaFactory distributionFactory, IObjectPathFactory objectPathFactory,
                       IDimensionRepository dimensionRepository, IIdGenerator idGenerator,
                       IDynamicFormulaCriteriaRepository dynamicFormulaCriteriaRepository)
 {
     _objectBaseFactory         = objectBaseFactory;
     _rateObjectPathsRepository = rateObjectPathsRepository;
     _rateFormulaRepository     = rateFormulaRepository;
     _distributionFactory       = distributionFactory;
     _objectPathFactory         = objectPathFactory;
     _dimensionRepository       = dimensionRepository;
     _idGenerator = idGenerator;
     _dynamicFormulaCriteriaRepository = dynamicFormulaCriteriaRepository;
 }
        protected override void Context()
        {
            var _calcMethodsRepo = IoC.Resolve <ICalculationMethodRepository>();

            IList <string> dynFormulaCalcMethodNames = new List <string>();

            var dynamicFormulasCalcMethods =
                _calcMethodsRepo.All().Where(cm => cm.Category.Equals(CoreConstants.Category.DynamicFormulas));

            dynamicFormulasCalcMethods.Each(cm => dynFormulaCalcMethodNames.Add(cm.Name));
            _dynamicFormulasCalcMethodNames = dynFormulaCalcMethodNames;

            _formulaRepo = IoC.Resolve <IRateFormulaRepository>();

            sut = IoC.Resolve <IDynamicFormulaCriteriaRepository>();
        }