public void Add_New_RunTest()
 {
     EF_RunDataRepository target = new EF_RunDataRepository();
     string name = "this was a new run";
     List<DataLabel> labels = new List<DataLabel>() { new DataLabel(name) };
     target.Add_New_Run(name, labels);
     Assert.IsNotNull(target.Get_RunData_object(name).DataLabels[0]);
     target.Delete_RunData_object(name);
 }
        public void Test_deletion_of_DataLabels_when_RunData_is_deleted()
        {
            SolarsplashEntities db = new SolarsplashEntities();
            EF_RunDataRepository target = new EF_RunDataRepository(db, true);

            string name = "this should be deleted";
            save_RunData_to_db(make_dummy_RunData_object(name), db);
            int id = target.Get_RunData_object(name).DataLabels[0].id_DataLabel;

            Assert.IsNotNull(db.RunData.Find(id));
            target.Delete_RunData_object(name);    //delete the RunData object
            Assert.IsNull(db.RunData.Find(id));
        }
 public void Add_RunElement_to_RunDataTest()
 {
     EF_RunDataRepository target = new EF_RunDataRepository();
     string name = "Test Run";
     int runNumber = 43;
     target.Add_New_Run(name, new List<DataLabel>());// add object to db
     RunElement element = new RunElement(new List<float>(), runNumber);
     bool expected = true;
     bool actual;
     actual = target.Add_RunElement_to_RunData(name, element);
     Assert.AreEqual(expected, actual);
     Assert.AreEqual(runNumber, target.Get_RunData_object(name).Runs[0].Number);
     actual = target.Delete_RunData_object(name);    //delect the object
     Assert.IsTrue(actual);
 }
        public void Delete_RunData_objectTest()
        {
            SolarsplashEntities db = new SolarsplashEntities();
            EF_RunDataRepository target = new EF_RunDataRepository(db, true);
            RunData item = new RunData();
            string name = "this should be deleted";
            item.Name = name;
            bool expected = true;
            bool actual;

            target.Add_New_Run(name, new List<DataLabel> {new DataLabel(name) });// add object to db
            int DataLabel_id = target.Get_RunData_object(name).DataLabels[0].id_DataLabel;

            Assert.IsNotNull(target.Get_RunData_base_object(name));
            actual = target.Delete_RunData_object(item);    //delete the object
            Assert.AreEqual(expected, actual);
            Assert.IsNull(target.Get_RunData_base_object(name));
            Assert.IsNull(db.DataLabel.Find(DataLabel_id)); // test to make sure child object got deleted as well
        }