protected override async Task Context() { await base.Context(); _refSimulation = new Simulation().WithName("REF_SIM"); _refLocalizedParameter = new LocalizedParameter { Path = "Organism|P", Value = 10 }; _simulationParameterSwap = new SimulationParameterSwap { Simulation = _refSimulation.Name, Path = _refLocalizedParameter.Path, TargetSimulations = new[] { "DOES NOT EXIST" }, SnapshotFile = "RefSnapshotPath" }; _refSimulation.Parameters = new[] { _refLocalizedParameter }; _qualificationConfiguration.SimulationParameters = new[] { _simulationParameterSwap }; _refSnapshotProject = new SnapshotProject { Simulations = new[] { _refSimulation } }; A.CallTo(() => _snapshotTask.LoadSnapshotFromFile <SnapshotProject>(_simulationParameterSwap.SnapshotFile)).Returns(_refSnapshotProject); }
protected override async Task Context() { await base.Context(); _simulationParameterSwap = new SimulationParameterSwap { Simulation = "DOES_NOT_EXIST", TargetSimulations = new[] { "DOES NOT EXIST" }, SnapshotFile = "RefSnapshotPath" }; _qualificationConfiguration.SimulationParameters = new[] { _simulationParameterSwap }; _refSnapshotProject = new SnapshotProject(); A.CallTo(() => _snapshotTask.LoadSnapshotFromFile <SnapshotProject>(_simulationParameterSwap.SnapshotFile)).Returns(_refSnapshotProject); }
private async Task swapSimulationParametersIn(Project projectSnapshot, SimulationParameterSwap simulationParameter) { var(parameterPath, simulationName, snapshotPath) = simulationParameter; var referenceSnapshot = await snapshotProjectFromFile(snapshotPath); var referenceSimulation = simulationFrom(referenceSnapshot, simulationName); var referenceParameter = referenceSimulation.ParameterByPath(parameterPath); if (referenceParameter == null) { throw new QualificationRunException(CannotFindSimulationParameterInSnapshot(parameterPath, simulationName, referenceSnapshot.Name)); } simulationParameter.TargetSimulations?.Each(targetSimulationName => { var targetSimulation = simulationFrom(projectSnapshot, targetSimulationName); targetSimulation.AddOrUpdate(referenceParameter); }); }
protected override async Task Context() { await base.Context(); _refSimulation = new Simulation().WithName("REF_SIM"); _simulationParameterSwap = new SimulationParameterSwap { Simulation = _refSimulation.Name, Path = "DOES NOT EXIST", SnapshotFile = "RefSnapshotPath" }; _qualificationConfiguration.SimulationParameters = new[] { _simulationParameterSwap }; _refSnapshotProject = new SnapshotProject { Simulations = new[] { _refSimulation } }; A.CallTo(() => _snapshotTask.LoadSnapshotFromFileAsync <SnapshotProject>(_simulationParameterSwap.SnapshotFile)).Returns(_refSnapshotProject); }