protected override void Context()
 {
     base.Context();
     _tableFormulaWithOffsetExport = new TableFormulaWithOffsetExport();
     _tableFormulaWithOffsetExport.TableObjectId  = 123;
     _tableFormulaWithOffsetExport.OffsetObjectId = 456;
     _tableFormulaWithOffsetExport.Id             = 789;
 }
예제 #2
0
        private FormulaExport createFormulaExport(IUsingFormula usingFormula, IFormula formula)
        {
            switch (formula)
            {
            case ExplicitFormula explicitFormula:
                var explicitFormulaExport = new ExplicitFormulaExport {
                    Equation = explicitFormula.FormulaString
                };
                addObjectReferencesTo(explicitFormula, explicitFormulaExport.ReferenceList);
                return(explicitFormulaExport);

            case TableFormulaWithXArgument tableFormulaWithXArgument:
                var tableFormulaWithXArgumentExport = new TableFormulaWithXArgumentExport()
                {
                    TableObjectId     = idFor(tableFormulaWithXArgument.GetTableObject(usingFormula)),
                    XArgumentObjectId = idFor(tableFormulaWithXArgument.GetXArgumentObject(usingFormula))
                };
                return(tableFormulaWithXArgumentExport);

            case TableFormulaWithOffset tableFormulaWithOffset:
                var tableFormulaWithOffsetExport = new TableFormulaWithOffsetExport
                {
                    TableObjectId  = idFor(tableFormulaWithOffset.GetTableObject(usingFormula)),
                    OffsetObjectId = idFor(tableFormulaWithOffset.GetOffsetObject(usingFormula))
                };
                return(tableFormulaWithOffsetExport);

            case TableFormula tableFormula:
                return(_tableFormulaExportMapper.MapFrom(tableFormula));

            default:
                return(new ExplicitFormulaExport {
                    Equation = formula.Calculate(usingFormula).ToString(NumberFormatInfo.InvariantInfo)
                });
            }
        }