public void SymptomManager_Insert_SymptomLog() { 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); //won't allow a duplicate name Assert.AreEqual( m.InsertLog(new SymptomLog() { AccountId = "a", Name = "TESTRECORD", DateCreated = DateTime.UtcNow , DoseUUID = "D" }) .Code, 500); }
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_GetSymptomsByDose() { 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); Assert.IsTrue(m.GetSymptomsByDose("D", "", "a").Count > 0); }
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 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_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); }