示例#1
0
        public void addUpdateContainerTest()
        {
            var id = 0;

            try
            {
                kcgCore.Models.Ontology             ontology  = new kcgCore.Models.Ontology();
                teKharta.InternalApi.KhartaOntology container = newTestContainer();
                //new teKharta.InternalApi.KhartaOntology();
                string containerName        = container.Name;
                string containerDescription = container.Description;
                container = teKharta.InternalApi.OntologyDataService.addUpdateContainer(container);
                id        = container.Id;
                if (container.Name == containerName)
                {
                    container.Name = "Test Name Changed";

                    container = teKharta.InternalApi.OntologyDataService.addUpdateContainer(container);
                    teKharta.InternalApi.OntologyDataService.deleteContainer(container);
                }
                Assert.IsTrue(id != 0 && id == container.Id && container.Name == "Test Name Changed");
            }
            catch (Exception ex)
            {
                Assert.Fail();
                Debug.WriteLine("error: " + ex.Message);
            }
        }
示例#2
0
        public void getContainerTest()
        {
            teKharta.InternalApi.KhartaOntology newContainer = newTestContainer();

            teKharta.InternalApi.KhartaOntology existingContainer = teKharta.InternalApi.OntologyDataService.addContainer(newContainer);
            teKharta.InternalApi.KhartaOntology container         = teKharta.InternalApi.OntologyDataService.getContainer(existingContainer.Id);
            Assert.IsTrue(existingContainer.Id == container.Id);
        }
示例#3
0
        public void addContainerTest()
        {
            var id = 0;

            try
            {
                teKharta.InternalApi.KhartaOntology container = newTestContainer();
                container = teKharta.InternalApi.OntologyDataService.addContainer(container);
                id        = container.Id;
                teKharta.InternalApi.OntologyDataService.deleteContainer(container);
                Assert.IsTrue(id != 0);
            }
            catch (Exception ex)
            {
                Assert.Fail();
                Debug.WriteLine("error: " + ex.Message);
            }
        }
示例#4
0
        /// <summary>
        /// creates a new test container obect
        /// </summary>
        /// <returns>KhartaOntology</returns>
        internal teKharta.InternalApi.KhartaOntology newTestContainer()
        {
            teKharta.InternalApi.KhartaOntology container = new teKharta.InternalApi.KhartaOntology();



            container.AvatarUrl        = "https://s.gravatar.com/avatar/533c75456f1e9fa7d8e539bccdb3eff7?s=80";
            container.ContainerId      = Guid.NewGuid();
            container.ContainerTypeId  = Guid.NewGuid();
            container.Description      = "test description";
            container.Name             = "TestName";
            container.IsEnabled        = true;
            container.Url              = "/testurl";
            container.ParentOntologyId = 1;
            container.SafeName         = "testurl";
            container.GroupId          = null;


            return(container);
        }
示例#5
0
        public void deleteContainerTest()
        {
            teKharta.InternalApi.KhartaOntology container = newTestContainer();

            container = teKharta.InternalApi.OntologyDataService.addContainer(container);
            if (container is teKharta.InternalApi.KhartaOntology && container.Id > 0)
            {
                teKharta.InternalApi.OntologyDataService.deleteContainer(container);
            }
            else
            {
                Assert.Fail();
            }
            if (container.Id > 0)
            {
                teKharta.InternalApi.KhartaOntology container2 = teKharta.InternalApi.OntologyDataService.getContainer(container.Id);
                //Assert equals 0 meaning an object is always returned
                Equals(container2.Id == 0);
            }
            else
            {
                Assert.Fail();
            }
        }