Exemple #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);
        }
Exemple #2
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;
 }