Ejemplo n.º 1
0
        public void GetObjectByIDWithSelectedAttributes()
        {
            ResourceManagementClient client          = new ResourceManagementClient();
            ResourceObject           resource        = client.CreateResource(UnitTestHelper.ObjectTypeUnitTestObjectName);
            List <string>            attributesToGet = new List <string>()
            {
                UnitTestHelper.AttributeBooleanSV, UnitTestHelper.AttributeStringSV, UnitTestHelper.AttributeReferenceMV
            };

            try
            {
                UnitTestHelper.PopulateTestUserData(resource);
                resource.Save();

                resource = client.GetResource(resource.ObjectID, attributesToGet);
                UnitTestHelper.ValidateSelectedAttributePresence(resource, attributesToGet);
                UnitTestHelper.ValidateTestUserData(resource, attributesToGet);
            }
            finally
            {
                if (resource != null && !resource.IsPlaceHolder)
                {
                    client.DeleteResource(resource);
                }
            }
        }
Ejemplo n.º 2
0
        public void GetObjectByMultipleKeysWithSelectedAttributes()
        {
            ResourceManagementClient client   = new ResourceManagementClient();
            ResourceObject           resource = client.CreateResource(UnitTestHelper.ObjectTypeUnitTestObjectName);
            string        newID           = Guid.NewGuid().ToString();
            List <string> attributesToGet = new List <string>()
            {
                AttributeNames.AccountName, UnitTestHelper.AttributeBooleanSV, UnitTestHelper.AttributeStringSV, UnitTestHelper.AttributeReferenceMV
            };

            Dictionary <string, object> keys = new Dictionary <string, object>();

            keys.Add(AttributeNames.AccountName, newID);
            keys.Add(UnitTestHelper.AttributeStringSV, UnitTestHelper.TestDataString1);

            try
            {
                UnitTestHelper.PopulateTestUserData(resource, newID);
                resource.Save();

                resource = client.GetResourceByKey(UnitTestHelper.ObjectTypeUnitTestObjectName, keys, attributesToGet);
                UnitTestHelper.ValidateSelectedAttributePresence(resource, attributesToGet);
                UnitTestHelper.ValidateTestUserData(resource, attributesToGet);
            }
            finally
            {
                if (resource != null && !resource.IsPlaceHolder)
                {
                    client.DeleteResource(resource);
                }
            }
        }