Exemplo n.º 1
0
        public void UpdateTest()
        {
            //Arrange
            int cateId, objectId;
            List <AccessResponse[]> list = new List <AccessResponse[]>();
            Client myClient = new Client(URL, APIKEY, LANGUAGE);

            myClient.Username = "******";
            myClient.Password = "******";
            Obj           objectRequest   = new Obj(myClient);
            AccessRequset categoryRequest = new AccessRequset();
            Access        access          = new Access(myClient);

            //Act:Create the Object
            objectRequest.type       = ObjectType.CLIENT;
            objectRequest.title      = " My Client";
            objectRequest.cmdbStatus = CmdbStatus.INOPERATION;
            objectId = objectRequest.Create();

            //Act: Create the Category
            categoryRequest.title         = "Web GUI";
            categoryRequest.description   = "Web GUI description";
            categoryRequest.type          = " ES";
            categoryRequest.formatted_url = "https://swsan.admin.acme-it.example/";
            cateId = access.Create(objectId, categoryRequest);

            //Act: Update the Category
            categoryRequest.title         = "Web GUI 2";
            categoryRequest.description   = "Web GUI 2 description";
            categoryRequest.type          = " SE";
            categoryRequest.formatted_url = "https://swsan.admin.acme-it.example/";
            categoryRequest.category_id   = cateId;
            access.Update(objectId, categoryRequest);

            //Act:Read the Category
            categoryRequest.category_id = cateId;
            list = access.Read(objectId);

            //Assert
            foreach (AccessResponse[] row in list)
            {
                foreach (AccessResponse element in row)
                {
                    Assert.AreEqual("Web GUI 2", categoryRequest.title);
                }
            }

            //Act:Delete the Object
            objectRequest.Delete(objectId);
        }
Exemplo n.º 2
0
        public void UpdateTest()
        {
            //Arrange
            int cateId, objectId;
            List <LocationResponse[]> list = new List <LocationResponse[]>();
            Client myClient = new Client(URL, APIKEY, LANGUAGE);

            myClient.Username = "******";
            myClient.Password = "******";
            Obj             objectRequest   = new Obj(myClient);
            LocationRequset categoryRequest = new LocationRequset();
            Location        Location        = new Location(myClient);

            //Act:Create the Object
            objectRequest.type       = ObjectType.CLIENT;
            objectRequest.title      = " My Client";
            objectRequest.cmdbStatus = CmdbStatus.INOPERATION;
            objectId = objectRequest.Create();

            //Act: Create the Category
            categoryRequest.latitude         = "12";
            categoryRequest.longitude        = "323";
            categoryRequest.snmp_syslocation = "23";
            categoryRequest.description      = "Web GUI description";

            cateId = Location.Create(objectId, categoryRequest);

            //Act: Update the Category
            categoryRequest.latitude         = "12";
            categoryRequest.longitude        = "323";
            categoryRequest.snmp_syslocation = "23";
            categoryRequest.description      = "Web GUI 2 description";

            Location.Update(objectId, categoryRequest);

            //Act:Read the Category
            list = Location.Read(objectId);

            //Assert
            foreach (LocationResponse[] row in list)
            {
                foreach (LocationResponse element in row)
                {
                    Assert.AreEqual("Web GUI 2 description", categoryRequest.description);
                }
            }
            //Act:Delete the Object
            objectRequest.Delete(objectId);
        }
Exemplo n.º 3
0
        public void CreateTest()
        {
            //Arrange
            int cateId, objectId;
            List <ModelResponse[]> list            = new List <ModelResponse[]>();
            ModelRequset           categoryRequest = new ModelRequset();
            Client myClient = new Client(URL, APIKEY, LANGUAGE);

            myClient.Username = "******";
            myClient.Password = "******";
            Obj   objectRequest = new Obj(myClient);
            Model model         = new Model(myClient);

            //Act:Create the Object
            objectRequest.type  = ObjectType.CLIENT;
            objectRequest.title = " My Client";

            objectRequest.cmdbStatus = CmdbStatus.INOPERATION;
            objectId = objectRequest.Create();

            //Act: Create the Category
            categoryRequest.title        = "Web GUI";
            categoryRequest.manufacturer = 1;
            categoryRequest.description  = "Web GUI description";
            cateId = model.Create(objectId, categoryRequest);

            //Assert
            Assert.IsNotNull(cateId);

            //Act: Read the Category
            list = model.Read(objectId);


            //Assert
            foreach (ModelResponse[] row in list)
            {
                foreach (ModelResponse element in row)
                {
                    Assert.IsNotNull(element.title);
                    Assert.IsNotNull(element.id);
                }
            }

            //Act:Delete the Object
            objectRequest.Delete(objectId);
        }
Exemplo n.º 4
0
        public void CreateTest()
        {
            //Arrange
            int cateId, objectId;
            List <IPResponse[]> list            = new List <IPResponse[]>();
            IPRequset           categoryRequest = new IPRequset();
            Client myClient = new Client(URL, APIKEY, LANGUAGE);

            myClient.Username = "******";
            myClient.Password = "******";
            Obj objectRequest = new Obj(myClient);
            IP  IP            = new IP(myClient);

            //Act:Create the Object
            objectRequest.type       = ObjectType.CLUSTER;
            objectRequest.title      = " My Cluster";
            objectRequest.cmdbStatus = CmdbStatus.INOPERATION;
            objectId = objectRequest.Create();

            //Act: Create the Category
            categoryRequest.ipv4_address = "1.1.1.2";
            categoryRequest.description  = "Web GUI description";
            cateId = IP.Create(objectId, categoryRequest);

            //Assert
            Assert.IsNotNull(cateId);

            //Act: Read the Category
            categoryRequest.category_id = cateId;
            list = IP.Read(objectId);


            //Assert
            foreach (IPResponse[] row in list)
            {
                foreach (IPResponse element in row)
                {
                    Assert.IsNotNull(element.ipv4_address);
                    Assert.IsNotNull(element.id);
                }
            }

            ////Act:Delete the Object
            objectRequest.Delete(objectId);
        }
Exemplo n.º 5
0
        public void DeleteTest()
        {
            //Arrange
            int    objID;
            Client myClient = new Client(URL, APIKEY, LANGUAGE);

            myClient.Username = "******";
            myClient.Password = "******";
            Obj request = new Obj(myClient);

            //Act:Create the Object
            request.type       = ObjectType.CLIENT;
            request.title      = " My Client";
            request.cmdbStatus = CmdbStatus.INOPERATION;
            objID = request.Create();
            //Act:Delete the Object
            request.Delete(objID);
            //Assert
            Assert.IsNotNull(objID);
        }
Exemplo n.º 6
0
        public void SearchTest()
        {
            //Arrange
            int    objID;
            Client myClient = new Client(URL, APIKEY, LANGUAGE);

            myClient.Username = "******";
            myClient.Password = "******";
            idoit           idoit   = new idoit(myClient);
            Obj             request = new Obj(myClient);
            List <Search[]> lists   = new List <Search[]>();

            //Act
            request.type       = ObjectType.PRINTER;
            request.title      = "Printer 01";
            request.cmdbStatus = CmdbStatus.DEFECT;
            objID = request.Create();


            //Act:Search
            lists = idoit.Search(request.title);

            //Assert
            foreach (Search[] row in lists)
            {
                foreach (Search element in row)
                {
                    Assert.IsNotNull(element.link);
                    Assert.IsNotNull(element.key);
                    Assert.IsNotNull(element.value);
                }
            }
            //Assert
            Assert.IsNotNull(objID);
            Assert.IsNotNull(request.title);
            Assert.IsNotNull(request.type);
            Assert.IsNotNull(request.cmdbStatus);

            //Act:Delete the Object
            request.Delete(objID);
        }
Exemplo n.º 7
0
        public void DeleteTestCheckIfTheObjectDeleted()
        {
            //Arrange
            int    objID;
            Result list     = new Result();
            Client myClient = new Client(URL, APIKEY, LANGUAGE);

            myClient.Username = "******";
            myClient.Password = "******";
            Obj request = new Obj(myClient);

            //Act:Create the Object
            request.type       = ObjectType.CLIENT;
            request.title      = "Laptop 001";
            request.cmdbStatus = CmdbStatus.PLANNED;
            objID = request.Create();
            //Act:Delete the Object
            request.Delete(objID);
            //Act:Read the Object
            list = request.Read(objID);
            //Assert
            Assert.AreEqual("4", list.status);
        }