예제 #1
0
        public void ExportModelPartsToExcelFile(string excelFileName, IMoBiSimulation simulation, bool openExcel)
        {
            var reactionDataTable            = _reactionBuildingBlockToReactionDataTableMapper.MapFrom(simulation.MoBiBuildConfiguration.MoBiReactions);
            var simulationParameterDataTable = _parameterListToSimulationParameterDataTableMapper.MapFrom(simulation.Model.Root.GetAllChildren <IParameter>());

            var moleculeParameterDataTable = _moleculeStartValuesBuildingBlockToParameterDataTableMapper.MapFrom(simulation.MoBiBuildConfiguration.MoleculeStartValues.Where(msv => msv.IsPresent), simulation.MoBiBuildConfiguration.Molecules);

            var dataTables = new List <DataTable> {
                reactionDataTable, simulationParameterDataTable, moleculeParameterDataTable
            };

            ExportToExcelTask.ExportDataTablesToExcel(dataTables, excelFileName, openExcel: openExcel);
        }
        public void ExportModelPartsToExcelFile(string excelFileName, IMoBiSimulation simulation, bool openExcel)
        {
            var reactionDataTable            = _reactionBuildingBlockToReactionDataTableMapper.MapFrom(simulation.MoBiBuildConfiguration.MoBiReactions);
            var simulationParameterDataTable = _parameterListToSimulationParameterDataTableMapper.MapFrom(simulation.Model.Root.GetAllChildren <IParameter>());

            var moleculeParameterDataTable = _moleculeStartValuesBuildingBlockToParameterDataTableMapper.MapFrom(simulation.MoBiBuildConfiguration.MoleculeStartValues.Where(msv => msv.IsPresent), simulation.MoBiBuildConfiguration.Molecules);

            var dataTables = new List <DataTable> {
                reactionDataTable, simulationParameterDataTable, moleculeParameterDataTable
            };

            ExportToExcelTask.ExportDataTablesToExcel(dataTables, excelFileName, openExcel: openExcel, workbookConfiguration: (wb, dt) =>
            {
                wb.setSelection(0, 0, 0, dt.Columns.Count);
                var rangeStyle      = wb.getRangeStyle();
                rangeStyle.FontBold = true;
                wb.setRangeStyle(rangeStyle);
            });
        }
        protected override void Context()
        {
            _reactionBuildingBlockToReactionDataTableMapper             = A.Fake <IReactionBuildingBlockToReactionDataTableMapper>();
            _parameterListToSimulationDataTableMapper                   = A.Fake <IParameterListToSimulationParameterDataTableMapper>();
            _moleculeStartValuesBuildingBlockToParameterDataTableMapper = A.Fake <IMoleculeStartValuesBuildingBlockToParameterDataTableMapper>();
            sut = new ModelPartsToExcelExporterTask(
                _reactionBuildingBlockToReactionDataTableMapper,
                _parameterListToSimulationDataTableMapper,
                _moleculeStartValuesBuildingBlockToParameterDataTableMapper
                );

            A.CallTo(() => _reactionBuildingBlockToReactionDataTableMapper.MapFrom(A <IMoBiReactionBuildingBlock> .Ignored)).Returns(new DataTable {
                TableName = "reactions"
            });
            A.CallTo(() => _parameterListToSimulationDataTableMapper.MapFrom(A <IReadOnlyList <IParameter> > .Ignored)).Returns(new DataTable {
                TableName = "parameters"
            });
            A.CallTo(() => _moleculeStartValuesBuildingBlockToParameterDataTableMapper.MapFrom(A <IEnumerable <IMoleculeStartValue> > .Ignored, A <IEnumerable <IMoleculeBuilder> > .Ignored)).Returns(new DataTable {
                TableName = "molecules"
            });
        }