Пример #1
0
        public void ReadTest()
        {
            //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.SERVER;
            request.title      = "Ceph Storage Pod A001 01";
            request.cmdbStatus = CmdbStatus.PLANNED;
            objID = request.Create();
            //Act:Read the Object
            list = request.Read(objID);
            //Assert
            Assert.AreEqual(objID, list.id);
            Assert.AreEqual("Ceph Storage Pod A001 01", list.title);
            Assert.IsNotNull(list.title);
            Assert.IsNotNull(list.cmdbStatus);
            //Act:Delete the Object
            request.Purge(objID);
        }
Пример #2
0
        public void ReadTest()
        {
            //Arrange
            List <Result[]> lists    = new List <Result[]>();
            Client          myClient = new Client(URL, APIKEY, LANGUAGE);

            myClient.Username = "******";
            myClient.Password = "******";
            ObjectsRead  request       = new ObjectsRead(myClient);
            ObjectCreate requestCreate = new ObjectCreate(myClient);
            Filter       filter        = new Filter();

            int[] ObjectId = new int[10];

            //Act:Create the Objects
            for (int i = 0; i < 10; i++)
            {
                requestCreate.type       = ObjectType.SYSTEM_SERVICE;
                requestCreate.title      = " System Service " + i;
                requestCreate.cmdbStatus = CmdbStatus.PLANNED;
                ObjectId[i] = requestCreate.Create();
            }

            //Act : Read Objects
            request.limit   = "0,10";
            request.orderBy = OrderBy.Title;
            request.sort    = Sort.Acsending;
            filter.ids      = new int[] { ObjectId[0], ObjectId[8] };
            filter.type     = "C__OBJTYPE__SERVICE";
            //filter.title = "SystemService";
            lists = request.Read(filter);

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

            //Act:Delete the Objects
            for (int i = 0; i < 10; i++)
            {
                requestCreate.Purge(ObjectId[i]);
            }
        }
Пример #3
0
        public void PurgeTest()
        {
            //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.MONITOR;
            request.title      = "TFT 001";
            request.cmdbStatus = CmdbStatus.STORED;
            objID = request.Create();

            //Act:Purge the Object
            request.Purge(objID);

            //Assert
            Assert.IsNotNull(objID);
        }