protected override async Task Context() { await base.Context(); _expectedOutputPath = Path.Combine(_qualificationConfiguration.OutputFolder, PROJECT_NAME); DirectoryHelper.DirectoryExists = s => string.Equals(s, _expectedOutputPath); DirectoryHelper.DeleteDirectory = (s, b) => _deletedDirectory = s; _simulationName = "S1"; _simulation = new Simulation { Name = _simulationName }; _individualSimulation = new IndividualSimulation { Name = _simulationName }; _input = new Input { Project = PROJECT_NAME, Name = _simulationName, SectionId = 2, Type = PKSimBuildingBlockType.Simulation }; _expectedSimulationPath = Path.Combine(_expectedOutputPath, _simulationName); _simulationExport = new SimulationExport { Project = PROJECT_NAME, Simulation = _simulationName, SimulationFolder = _expectedSimulationPath }; _simulationExports = new[] { _simulationExport }; A.CallTo(() => _exportSimulationRunner.ExportSimulationsIn(_project, A <ExportRunOptions> ._)) .Invokes(x => _exportOptions = x.GetArgument <ExportRunOptions>(1)) .Returns(_simulationExports); _observedData = DomainHelperForSpecs.ObservedData().WithName("OBS"); _project.AddObservedData(_observedData); _projectSnapshot.Simulations = new[] { _simulation }; _expectedObservedDataXlsFullPath = Path.Combine(_qualificationConfiguration.ObservedDataFolder, $"{_observedData.Name}{Constants.Filter.XLSX_EXTENSION}"); _expectedObservedDataCsvFullPath = Path.Combine(_qualificationConfiguration.ObservedDataFolder, $"{_observedData.Name}{Constants.Filter.CSV_EXTENSION}"); _expectedInputFullPath = Path.Combine(_qualificationConfiguration.InputsFolder, PROJECT_NAME, PKSimBuildingBlockType.Simulation.ToString(), $"{_simulationName}{CoreConstants.Filter.MARKDOWN_EXTENSION}"); A.CallTo(() => _jsonSerializer.Serialize(A <QualificationMapping> ._, _qualificationConfiguration.MappingFile)) .Invokes(x => _mapping = x.GetArgument <QualificationMapping>(0)); _project.AddBuildingBlock(_individualSimulation); _qualificationConfiguration.Inputs = new[] { _input }; }
public SimulationExport CreateExportFor(IModel model, SimModelExportMode exportMode) { try { _modelExport = new SimulationExport(); _idMap = new Cache <string, int> { { Constants.TIME, 0 } }; _exportMode = exportMode; _allProcesses = model.Root.GetAllChildren <IProcess>(); _modelExport.ObjectPathDelimiter = ObjectPath.PATH_DELIMITER; model.Root.AcceptVisitor(this); return(_modelExport); } finally { _allProcesses = null; _modelExport = null; } }
protected override void Because() { _res = sut.CreateExportFor(_model); }
protected override async Task Because() { _export = await sut.ExportSimulation(_simulation1, _exportRunOptions, _project); }