Esempio n. 1
0
        public void AnatomyManager_DeleteAnatomyTag()
        {
            AnatomyManager m = new AnatomyManager(new TreeMonDbContext(connectionKey));
            AnatomyTag     s = new AnatomyTag()
            {
                AccountId   = "a",
                Name        = "DELETERECORD",
                CreatedBy   = "TESTUSER",
                DateCreated = DateTime.UtcNow
            };

            m.Insert(s);

            //Test the delete flag
            Assert.IsTrue(m.DeleteAnatomyTag(s) > 0);
            m.GetAnatomyTag("DELETERECORD");
            AnatomyTag d = m.GetAnatomyTag("DELETERECORD");

            Assert.IsNotNull(d);
            Assert.IsTrue(d.Deleted == true);


            Assert.IsTrue(m.DeleteAnatomyTag(s, true) > 0);
            d = m.GetAnatomyTag("DELETERECORD");
            Assert.IsNull(d);
        }
Esempio n. 2
0
        public void AnatomyManager_UpdateAnatomyTag()
        {
            AnatomyManager m = new AnatomyManager(new TreeMonDbContext(connectionKey));

            m.Insert(new AnatomyTag()
            {
                AccountId = "a",
                Name      = "TESTRECORD",
                UUID      = Guid.NewGuid().ToString("N")
            });
            AnatomyTag s = m.GetAnatomyTag("TESTRECORD");

            s.Name = "UPDATEDRECORD";

            Assert.AreEqual(m.UpdateAnatomyTag(s).Code, 200);
            AnatomyTag u = m.GetAnatomyTag("UPDATEDRECORD");

            Assert.IsNotNull(u);
        }
Esempio n. 3
0
        public void AnatomyManager_GetAnatomyTag()
        {
            AnatomyManager m  = new AnatomyManager(new TreeMonDbContext(connectionKey));
            ServiceResult  sr = m.Insert(new AnatomyTag()
            {
                AccountId   = "a",
                Name        = "ALPHA",
                UUID        = Guid.NewGuid().ToString("N"),
                DateCreated = DateTime.UtcNow
            }, false);

            Assert.AreEqual(sr.Code, 200, sr.Message);
            AnatomyTag s = m.GetAnatomyTag("ALPHA");

            Assert.IsNotNull(s);
        }
Esempio n. 4
0
        public void AnatomyManager_GetAnatomyTagBy()
        {
            AnatomyManager m  = new AnatomyManager(new TreeMonDbContext(connectionKey));
            ServiceResult  sr = m.Insert(new AnatomyTag()
            {
                AccountId   = "a",
                Name        = "TESTRECORD",
                DateCreated = DateTime.UtcNow
            }, false);

            AnatomyTag s = m.GetAnatomyTag("TESTRECORD");

            Assert.IsNotNull(s);
            AnatomyTag suid = m.GetAnatomyTagBy(s.UUID);

            Assert.IsNotNull(suid);
        }
Esempio n. 5
0
        public ServiceResult Get(string name)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                return(ServiceResponse.Error("You must provide a name for the AnatomyTags."));
            }

            AnatomyManager AnatomyTagsManager = new AnatomyManager(Globals.DBConnectionKey, Request.Headers?.Authorization?.Parameter);
            AnatomyTag     s = AnatomyTagsManager.GetAnatomyTag(name);

            if (s == null)
            {
                return(ServiceResponse.Error("AnatomyTags could not be located for the name " + name));
            }

            return(ServiceResponse.OK("", s));
        }