Пример #1
0
        public void CreateReadTest()
        {
            //Arrange
            int cateId, objectId;
            var objectRequest   = new IdoitObjectInstance(idoitClient);
            var categoryRequest = new IPRequest();
            var IP = new IdoitMvcInstance <IPResponse>(idoitClient);

            //Act:Create the Object
            objectRequest.CmdbStatus = IdoitCmdbStatus.INOPERATION;
            objectRequest.Type       = IdoitObjectTypes.CLUSTER;
            objectRequest.Value      = "My Cluster 2";
            objectId = objectRequest.Create();

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

            //Act:Read the Category
            var list = IP.Read();

            Assert.IsTrue(list.Length > 0, "No objects found");
            //Assert
            foreach (IPResponse v in list)
            {
                Assert.IsNotNull(v.ipv4_address.refTitle);
            }
            //Act:Delete the Object
            objectRequest.ObjectId = objectId;
            objectRequest.Delete();
        }
Пример #2
0
        public void UpdateTest()
        {
            //Arrange
            int cateId, objectId;
            var objectRequest   = new IdoitObjectInstance(idoitClient);
            var categoryRequest = new AccessRequest();
            var access          = new IdoitMvcInstance <AccessResponse>(idoitClient);

            //Act:Create the Object
            objectRequest.CmdbStatus = IdoitCmdbStatus.INOPERATION;
            objectRequest.Type       = IdoitObjectTypes.CLIENT;
            objectRequest.Value      = "My Client";
            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/";
            access.ObjectId      = objectId;
            access.ObjectRequest = categoryRequest;
            cateId = access.Create();

            //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;
            //categoryRequest.category_id = cateId;
            access.ObjectRequest = categoryRequest;
            access.Update();

            //Act:Read the Category
            var list = access.Read();

            Assert.IsTrue(list.Length > 0, "No objects found");
            //Assert
            foreach (AccessResponse v in list)
            {
                Assert.AreEqual("Web GUI 2", v.title);
            }

            //Act:Delete the Object
            objectRequest.ObjectId = objectId;
            objectRequest.Delete();
        }
Пример #3
0
        public void UpdateTest()
        {
            //Arrange
            int cateId, objectId;
            var objectRequest   = new IdoitObjectInstance(idoitClient);
            var categoryRequest = new LocationRequest();
            var Location        = new IdoitSvcInstance <LocationResponse>(idoitClient);

            //Act:Create the Object
            objectRequest.CmdbStatus = IdoitCmdbStatus.INOPERATION;
            objectRequest.Type       = IdoitObjectTypes.CLIENT;
            objectRequest.Value      = "My IdoitClient";
            objectId = objectRequest.Create();

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

            Location.ObjectId      = objectId;
            Location.ObjectRequest = categoryRequest;
            cateId = Location.Create();

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

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

            Assert.IsTrue(list.Length > 0, "No objects found");
            //Assert
            foreach (LocationResponse v in list)
            {
                Assert.AreEqual("Web GUI 2 description", v.description);
            }
            //Act:Delete the Object
            objectRequest.ObjectId = objectId;
            objectRequest.Delete();
        }
Пример #4
0
        public void UpdateTest()
        {
            //Arrange
            int cateId, objectId;
            var objectRequest   = new IdoitObjectInstance(idoitClient);
            var categoryRequest = new ModelRequest();
            var model           = new IdoitSvcInstance <ModelResponse>(idoitClient);

            //Act:Create the Object
            objectRequest.CmdbStatus = IdoitCmdbStatus.INOPERATION;
            objectRequest.Type       = IdoitObjectTypes.CLIENT;
            objectRequest.Value      = "My Client";
            objectId = objectRequest.Create();

            //Act: Create the Category
            categoryRequest.title        = "Web GUI";
            categoryRequest.description  = "Web GUI description";
            categoryRequest.manufacturer = 1;

            model.ObjectId      = objectId;
            model.ObjectRequest = categoryRequest;
            cateId = model.Create();

            //Act: Update the Category
            categoryRequest.title       = "Web GUI 2";
            categoryRequest.description = "Web GUI 2 description";
            model.ObjectRequest         = categoryRequest;
            model.Update();

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

            Assert.IsTrue(list.Length > 0, "No objects found");
            //Assert
            foreach (ModelResponse v in list)
            {
                Assert.AreEqual("Web GUI 2", v.title.title);
            }
            //Act:Delete the Object
            objectRequest.ObjectId = objectId;
            objectRequest.Delete();
        }
Пример #5
0
        public void DeleteTestCheckIfTheObjectDeleted()
        {
            //Arrange
            int objID;
            var result  = new IdoitObjectResult();
            var request = new IdoitObjectInstance(idoitClient);

            //Act:Create the Object
            request.CmdbStatus = IdoitCmdbStatus.PLANNED;
            request.Type       = IdoitObjectTypes.CLIENT;
            request.Value      = "Laptop 001";
            objID = request.Create();
            Assert.IsNotNull(objID);
            //Act:Delete the Object
            request.ObjectId = objID;
            request.Delete();
            //Act:Read the Object
            result = request.Read();
            //Assert
            Assert.AreEqual(IdoitStatusTypes.Deleted, result.status);
        }
Пример #6
0
        public void UpdateTest()
        {
            //Arrange
            int objID;
            var result  = new IdoitObjectResult();
            var request = new IdoitObjectInstance(idoitClient);

            //Act:Create the Object
            request.CmdbStatus = IdoitCmdbStatus.INOPERATION;
            request.Type       = IdoitObjectTypes.SERVER;
            request.Value      = "Switch Colo A001 02";
            objID = request.Create();
            //Act:Update the Object
            request.ObjectId = objID;
            request.Value    = "Switch Colo A001 01";
            request.Update();
            //Act:Read the Object
            result = request.Read();
            //Assert
            Assert.AreEqual("Switch Colo A001 01", result.title);
            request.Delete();
        }
Пример #7
0
        public void ReadTest()
        {
            //Arrange
            int objID;
            var result  = new IdoitObjectResult();
            var request = new IdoitObjectInstance(idoitClient);

            //Act:Create the Object
            request.CmdbStatus = IdoitCmdbStatus.PLANNED;
            request.Type       = IdoitObjectTypes.SERVER;
            request.Value      = "Ceph Storage Pod A001 01";
            objID = request.Create();
            //Act:Read the Object
            request.ObjectId = objID;
            result           = request.Read();
            //Assert
            Assert.AreEqual(objID, result.id);
            Assert.AreEqual("Ceph Storage Pod A001 01", result.title);
            Assert.IsNotNull(result.title);
            Assert.IsNotNull(result.cmdbStatus);
            //Act:Delete the Object
            request.Delete();
        }
Пример #8
0
        public void SearchTest()
        {
            //Arrange
            int objID;
            var idoit   = new IdoitInstance(idoitClient);
            var request = new IdoitObjectInstance(idoitClient);

            //Act
            request.CmdbStatus = IdoitCmdbStatus.DEFECT;
            request.Type       = IdoitObjectTypes.PRINTER;
            request.Value      = "Printer 01";
            objID = request.Create();

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

            Assert.IsTrue(lists.Length > 0, "No objects found");
            //Assert

            foreach (var v in lists)
            {
                Assert.IsNotNull(v.link);
                Assert.IsNotNull(v.key);
                Assert.IsNotNull(v.value);
            }

            //Assert
            Assert.IsNotNull(objID);
            Assert.IsNotNull(request.Value);
            Assert.IsNotNull(request.Type);
            Assert.IsNotNull(request.CmdbStatus);

            //Act:Delete the Object
            request.ObjectId = objID;
            request.Delete();
        }