public virtual async Task <TResponse> ParseResponseDataAsync(string data, CancellationToken cancelToken)
        {
            Func <ScEntityResponse> syncParseResponse = () =>
            {
                //TODO: @igk debug response output, remove later
                //Debug.WriteLine("RESPONSE: " + data);

                return(ScReadEntitiesParser.Parse(data, this.statusCode, cancelToken));
            };

            return(await Task.Factory.StartNew(syncParseResponse, cancelToken) as TResponse);
        }
        public void TestParseNullValueConversion()
        {
            string           rawResponse = VALID_RESPONSE;
            ScEntityResponse response    = ScReadEntitiesParser.Parse(rawResponse, 200, CancellationToken.None);

            Assert.AreEqual(2, response.ResultCount);

            ISitecoreEntity entity = response[0];

            Assert.AreEqual(string.Empty, entity["Url"].RawValue);

            Assert.AreEqual(5, entity.FieldsCount);
        }
        public void TestParseBoolValuesConversionToString()
        {
            string           rawResponse = VALID_RESPONSE;
            ScEntityResponse response    = ScReadEntitiesParser.Parse(rawResponse, 200, CancellationToken.None);

            Assert.AreEqual(2, response.ResultCount);

            ISitecoreEntity entity = response[0];

            Assert.AreEqual("False", entity["Completed"].RawValue);

            Assert.AreEqual(5, entity.FieldsCount);
        }
        public void TestParseValidResponse()
        {
            string           rawResponse = VALID_RESPONSE;
            ScEntityResponse response    = ScReadEntitiesParser.Parse(rawResponse, 200, CancellationToken.None);

            Assert.AreEqual(2, response.ResultCount);

            ISitecoreEntity entity = response[0];

            Assert.AreEqual("First Task", entity["Title"].RawValue);
            Assert.AreEqual("False", entity["Completed"].RawValue);
            Assert.AreEqual("4", entity["Index"].RawValue);

            Assert.AreEqual(5, entity.FieldsCount);
        }
        public void TestParseFieldNamesIsCaseSensitive()
        {
            string           rawResponse = VALID_RESPONSE;
            ScEntityResponse response    = ScReadEntitiesParser.Parse(rawResponse, 200, CancellationToken.None);

            Assert.AreEqual(2, response.ResultCount);

            ISitecoreEntity entity = response[0];

            Assert.AreEqual("First Task", entity["Title"].RawValue);

            string result;

            TestDelegate action = () => result = entity["title"].RawValue;

            Assert.Throws <KeyNotFoundException>(action);

            Assert.AreEqual(5, entity.FieldsCount);
        }