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)));
 }
 public override void GlobalContext()
 {
     base.GlobalContext();
     _sim1 = new SimulationMetaData {
         Id = "sim1", Name = "sim1"
     };
     _sim1.AddObservedData("ObsData1");
     _sim2 = new SimulationMetaData {
         Id = "sim2", Name = "sim2"
     };
     _sim2.AddObservedData("ObsData1");
 }
        public void should_be_able_to_save_the_simulation()
        {
            var newSimulation = new SimulationMetaData {
                Id = "SimulationMetaDataId", Name = "tralala"
            };

            newSimulation.AddObservedData("ObsData1");
            newSimulation.AddObservedData("ObsData2");

            using (var session = _sessionFactory.OpenSession())
                using (var transaction = session.BeginTransaction())
                {
                    var simulationFromDb = session.Get <SimulationMetaData>(sut.Id);
                    simulationFromDb.UpdateFrom(newSimulation, session);
                    transaction.Commit();
                }

            using (var session = _sessionFactory.OpenSession())
            {
                var simulationFromDb = session.Get <SimulationMetaData>(sut.Id);
                simulationFromDb.UsedObservedData.Count.ShouldBeEqualTo(2);
            }
        }
 public override void GlobalContext()
 {
     base.GlobalContext();
     sut = new SimulationMetaData {
         Id = "SimulationMetaDataId", Name = "tralala"
     };
     sut.AddObservedData("ObsData1");
     using (var session = _sessionFactory.OpenSession())
         using (var transaction = session.BeginTransaction())
         {
             session.Save(sut);
             transaction.Commit();
         }
 }