예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
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);
        }
예제 #5
0
        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);
        }
예제 #6
0
        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);
        }