Esempio n. 1
0
        public async Task TestMetadataWithUnAuthenticatedClient()
        {
            RestResponse response =
                await _unauthenticatedRestClient.SendAsync(RestRequest.GetRequestForMetadata(TestCredentials.API_VERSION, "account"));

            Assert.AreEqual(response.StatusCode.ToString().ToLower(), HttpStatusCode.Unauthorized.ToString().ToLower());
        }
Esempio n. 2
0
        public void TestGetRequestForMetadata()
        {
            RestRequest request = RestRequest.GetRequestForMetadata(TEST_API_VERSION, TEST_OBJECT_TYPE);

            Assert.AreEqual(RestMethod.GET, request.Method, "Wrong method");
            Assert.AreEqual(ContentType.NONE, request.ContentType, "Wrong content type");
            Assert.AreEqual("/services/data/" + TEST_API_VERSION + "/sobjects/" + TEST_OBJECT_TYPE + "/", request.Path, "Wrong path");
            Assert.IsNull(request.Body, "Wrong request body");
            Assert.IsNull(request.AdditionalHeaders, "Wrong additional headers");
        }
Esempio n. 3
0
        public void TestGetRequestForMetadata()
        {
            RestRequest request = RestRequest.GetRequestForMetadata(TEST_API_VERSION, TEST_OBJECT_TYPE);

            Assert.AreEqual(HttpMethod.Get, request.Method, "Wrong method");
            Assert.AreEqual(ContentTypeValues.None, request.ContentType, "Wrong content type");
            Assert.AreEqual("/services/data/" + TEST_API_VERSION + "/sobjects/" + TEST_OBJECT_TYPE + "/", request.Path,
                            "Wrong path");
            Assert.IsNull(request.RequestBody, "Wrong request body");
            Assert.AreEqual(request.AdditionalHeaders.Count, 0);
        }
        public void TestMetadata()
        {
            RestResponse response = _restClient.SendSync(RestRequest.GetRequestForMetadata(TestCredentials.API_VERSION, "account"));

            CheckResponse(response, HttpStatusCode.OK, false);
            JObject jsonResponse = response.AsJObject;

            CheckKeys(jsonResponse, "objectDescribe", "recentItems");
            CheckKeys((JObject)jsonResponse["objectDescribe"], "name", "label", "keyPrefix");
            Assert.AreEqual("Account", jsonResponse["objectDescribe"]["name"], "Wrong object name");
        }
        public async Task TestMetadata()
        {
            var response =
                await _restClient.SendAsync(RestRequest.GetRequestForMetadata(new TestCredentials().ApiVersion, "account"));

            CheckResponse(response, HttpStatusCode.OK, false);
            JObject jsonResponse = response.AsJObject;

            CheckKeys(jsonResponse, "objectDescribe", "recentItems");
            CheckKeys((JObject)jsonResponse["objectDescribe"], "name", "label", "keyPrefix");
            Assert.AreEqual("Account", jsonResponse["objectDescribe"]["name"], "Wrong object name");
        }