Ejemplo n.º 1
0
        public void QuickpurgeTest()
        {
            //Arrange
            int    cateId, objectId;
            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
            access.Quickpurge(objectId, cateId);
        }
Ejemplo n.º 2
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);
        }