Beispiel #1
0
        protected override async Task Context()
        {
            await base.Context();

            _simulation = A.Fake <Simulation>().WithName("Sim");
            A.CallTo(() => _simulation.HasResults).Returns(true);
            _fileFullPath = "file full path";
            A.CallTo(() => _dialogCreator.AskForFileToSave(PKSimConstants.UI.ExportSimulationResultsToCSV, Constants.Filter.CSV_FILE_FILTER, Constants.DirectoryKey.REPORT, CoreConstants.DefaultResultsExportNameFor(_simulation.Name), null))
            .Returns(_fileFullPath);
        }
Beispiel #2
0
        protected override async Task Context()
        {
            await base.Context();

            _simulation = A.Fake <IndividualSimulation>();
            A.CallTo(() => _simulation.HasResults).Returns(true);
            A.CallTo(() => _simulation.Name).Returns("toto");
            A.CallTo(() => _simulation.DataRepository).Returns(new DataRepository());
            _excelFile = "tralala";
            A.CallTo(() => _dialogCreator.AskForFileToSave(PKSimConstants.UI.ExportSimulationResultsToExcel, Constants.Filter.EXCEL_SAVE_FILE_FILTER, Constants.DirectoryKey.REPORT, CoreConstants.DefaultResultsExportNameFor(_simulation.Name), null)).Returns(_excelFile);
        }
        public Task ExportResultsToCSVAsync(Simulation simulation)
        {
            _buildingBlockTask.LoadResults(simulation);
            if (!simulation.HasResults)
            {
                throw new PKSimException(PKSimConstants.Error.CannotExportResultsPleaseRunSimulation(simulation.Name));
            }

            return(exportToFileAsync(PKSimConstants.UI.ExportSimulationResultsToCSV, Constants.Filter.CSV_FILE_FILTER, CoreConstants.DefaultResultsExportNameFor(simulation.Name), async fileName => { await ExportResultsToCSVAsync(simulation, fileName); }, Constants.DirectoryKey.REPORT));
        }
        public Task ExportResultsToExcel(IndividualSimulation individualSimulation)
        {
            _buildingBlockTask.LoadResults(individualSimulation);
            if (!individualSimulation.HasResults)
            {
                throw new PKSimException(PKSimConstants.Error.CannotExportResultsPleaseRunSimulation(individualSimulation.Name));
            }

            return(exportToFileAsync(PKSimConstants.UI.ExportSimulationResultsToExcel, Constants.Filter.EXCEL_SAVE_FILE_FILTER, CoreConstants.DefaultResultsExportNameFor(individualSimulation.Name), async fileName =>
            {
                var dataTables = _dataRepositoryTask.ToDataTable(individualSimulation.DataRepository, x => _quantityDisplayPathMapper.DisplayPathAsStringFor(individualSimulation, x), x => x.Dimension);
                await Task.Run(() => _dataRepositoryTask.ExportToExcel(dataTables, fileName, launchExcel: true));
            }, Constants.DirectoryKey.REPORT));
        }
 protected override void Context()
 {
     base.Context();
     _simulation = A.Fake <IndividualSimulation>();
     _dataTables = new List <DataTable>();
     A.CallTo(() => _simulation.HasResults).Returns(true);
     A.CallTo(() => _simulation.Name).Returns("toto");
     A.CallTo(() => _simulation.DataRepository).Returns(new DataRepository());
     _excelFile = "tralala";
     A.CallTo(() => _dialogCreator.AskForFileToSave(PKSimConstants.UI.ExportSimulationResultsToExcel, Constants.Filter.EXCEL_SAVE_FILE_FILTER, Constants.DirectoryKey.REPORT, CoreConstants.DefaultResultsExportNameFor(_simulation.Name), null)).Returns(_excelFile);
     A.CallTo(() => _dataRepositoryTask.ToDataTable(_simulation.DataRepository, A <Func <DataColumn, string> > ._, A <Func <DataColumn, IDimension> > ._, false, true)).Returns(_dataTables);
 }
        public Task ExportResultsToExcelAsync(IndividualSimulation individualSimulation)
        {
            _buildingBlockTask.LoadResults(individualSimulation);
            if (!individualSimulation.HasResults)
            {
                throw new PKSimException(PKSimConstants.Error.CannotExportResultsPleaseRunSimulation(individualSimulation.Name));
            }

            return(exportToFileAsync(PKSimConstants.UI.ExportSimulationResultsToExcel, Constants.Filter.EXCEL_SAVE_FILE_FILTER, CoreConstants.DefaultResultsExportNameFor(individualSimulation.Name),
                                     fileName => ExportResultsToExcelAsync(individualSimulation, fileName), Constants.DirectoryKey.REPORT));
        }