private void updateSimulationProperties(Simulation simulation, SimulationMetaData simMetaData) { simulation.UsedBuildingBlocks.Each(bb => simMetaData.AddBuildingBlock(mapFrom(bb))); simMetaData.Properties.Data = _serializationManager.Serialize(simulation.Properties); simulation.UsedObservedData.Each(x => simMetaData.AddObservedData(x.Id)); simulation.Analyses.Each(chart => simMetaData.AddChart(mapFrom(chart))); }
protected override void Context() { base.Context(); _session = _sessionFactory.OpenSession(); A.CallTo(() => _sessionManager.OpenSession()).Returns(_session); _simulation = new SimulationMetaData { Id = "tralala", Name = " toto" }; _simulation.AddChart(new SimulationChartMetaData { Id = "Chart1", Name = "Chart1", Content = { Data = Encoding.UTF8.GetBytes("chart1") } }); _simulation.AddChart(new SimulationChartMetaData { Id = "Chart2", Name = "Chart2", Content = { Data = Encoding.UTF8.GetBytes("chart2") } }); using (var session = _sessionFactory.OpenSession()) using (var transaction = session.BeginTransaction()) { session.Save(_simulation); transaction.Commit(); } }