예제 #1
0
        public void CRUDNodes(int cores, int memory, NodeType target)
        {
            var sku       = new SKU(cores, memory, target);
            var nodeName  = $"{DateTime.UtcNow.Minute}:{DateTime.UtcNow.Second}-Pinocho";
            var nodeName2 = $"{DateTime.UtcNow.Minute}:{DateTime.UtcNow.Second}-Monstro";

            // First create a new node
            var createdNode = _api.CreateNode(nodeName, _testOrganization, sku);

            //Check for the nodes existance using the helper function
            var foundNode = FindNodeByName(nodeName);

            Assert.IsNotNull(foundNode);

            //Update that node with a new name
            var updateNodeRequest = _api.UpdateNode(foundNode.Id, nodeName2, _testOrganization);

            Assert.IsTrue(updateNodeRequest.Success);

            //Read again and check for the new name (nodeName2)
            foundNode = FindNodeByName(nodeName2);
            Assert.IsNotNull(foundNode);

            //Delete this node
            var deleteNodeRequest = _api.DeleteNode(foundNode.Id, _testOrganization);

            Assert.IsTrue(deleteNodeRequest.Success);

            //Read again and ensure the node does not exist.
            foundNode = FindNodeByName(nodeName2);
            Assert.IsNull(foundNode);
        }