public void SymptomManager_DeleteSymptomLog() { SymptomManager m = new SymptomManager(new TreeMonDbContext(connectionKey)); SymptomLog s = new SymptomLog() { AccountId = "a", Name = "DELETERECORD", CreatedBy = "TESTUSER", DateCreated = DateTime.UtcNow, DoseUUID = "D" }; m.InsertLog(s); //Test the delete flag Assert.IsTrue(m.DeleteSymptomLog(s) > 0); m.GetSymptomLog("DELETERECORD"); SymptomLog d = m.GetSymptomLog("DELETERECORD"); Assert.IsNotNull(d); Assert.IsTrue(d.Deleted == true); Assert.IsTrue(m.DeleteSymptomLog(s, true) > 0); d = m.GetSymptomLog("DELETERECORD"); Assert.IsNull(d); }
public void SymptomManager_UpdateSymptomLog() { SymptomManager m = new SymptomManager(new TreeMonDbContext(connectionKey)); m.InsertLog(new SymptomLog() { AccountId = "a", Name = "TESTRECORD", DoseUUID = "D" }); SymptomLog s = m.GetSymptomLog("TESTRECORD"); s.Name = "UPDATEDRECORD"; Assert.AreEqual(m.UpdateSymptomLog(s).Code, 200); SymptomLog u = m.GetSymptomLog("UPDATEDRECORD"); Assert.IsNotNull(u); }
public void SymptomManager_GetSymptomLog() { SymptomManager m = new SymptomManager(new TreeMonDbContext(connectionKey)); ServiceResult sr = m.InsertLog(new SymptomLog() { AccountId = "a", Name = "ALPHA", DateCreated = DateTime.UtcNow , DoseUUID = "D" }, false); Assert.AreEqual(sr.Code, 200, sr.Message); SymptomLog s = m.GetSymptomLog("ALPHA"); Assert.IsNotNull(s); }
public ServiceResult GetSymptomLog(string name = "") { if (string.IsNullOrWhiteSpace(name)) { return(ServiceResponse.Error("You must provide a name for the SymptomLog.")); } SymptomManager symptomManager = new SymptomManager(Globals.DBConnectionKey, this.GetAuthToken(Request)); SymptomLog s = symptomManager.GetSymptomLog(name); if (s == null) { return(ServiceResponse.Error("SymptomLog could not be located for the name " + name)); } return(ServiceResponse.OK("", s)); }
public void SymptomManager_GetSymptomLogBy() { SymptomManager m = new SymptomManager(new TreeMonDbContext(connectionKey)); Assert.AreEqual( m.InsertLog(new SymptomLog() { AccountId = "a", Name = "TESTRECORD", DateCreated = DateTime.UtcNow , DoseUUID = "D" }, false) .Code, 200); SymptomLog s = m.GetSymptomLog("TESTRECORD"); Assert.IsNotNull(s); SymptomLog suid = m.GetSymptomLogBy(s.UUID); Assert.IsNotNull(suid); }