public void AddExperiment() { SetUp(); experimentsDAO.Add(e); Assert.IsTrue(e.Id == 1); var e2 = db.Experiments[0]; Assert.IsTrue(e2.Count == d.Count && !e2.Except(d).Any()); }
private void AddExperiment(Experiment experiment) { if (dataGridViewExperiment.InvokeRequired) { var d = new AddExperimentDeligate(AddExperiment); object[] objects = { experiment }; Invoke(d, objects); } else { Experiments.Add(experiment); dataGridViewExperiment.DataSource = null; dataGridViewExperiment.DataSource = Experiments; dataGridViewExperiment.Refresh(); } }
public void SaveExperimentDetails(ExperimentModel experiment) { var toUpdate = Experiments.FirstOrDefault(x => x.Id == experiment.Id); if (toUpdate == null) { Experiments.Add(experiment); } else { toUpdate.Save(experiment); } OnExperimentsChanged(); OnPlatesChanged(); }
public void UpdateExperiment() { SetUp(); db = new InMemoryDatabase(); experimentsDAO = new Experiments(db); experimentsDAO.Add(e); e.Summary = "summary"; experimentsDAO.Update(e); d["summary"] = "summary"; Assert.IsTrue(db.Experiments.Count() == 1); var e2 = db.Experiments[0]; Assert.IsTrue(e2.Count == d.Count); Assert.IsFalse(e2.Except(d).Any()); }
public void AddExperiment(Experiment experiment, int userPermissionLevel = 0) { #region Preconditions if (string.IsNullOrEmpty(experiment.Name)) { throw new InvalidOperationException("Cannot add experiment with empty Name"); } if (userPermissionLevel < MinUserLevelToAdmin) { throw new SecurityException("Cannot add experiment with current user permission"); } if (Started) { throw new InvalidOperationException("Cannot add experiment to running server"); } if (Experiments.Values.Any(x => x.Name == experiment.Name)) { throw new InvalidOperationException(string.Format("Cannot add experiment with dupplicate name: {0}", experiment.Name)); } #endregion Experiments.Add(experiment.Name, experiment); }