Example #1
0
        public string CompareArray(out string error)
        {
            error = null;
            try
            {
                JArray jsonBodyReceived = JArray.Parse(this.ResponseDataReceived.Body);
                JArray jsonBodyExpected = JArray.Parse(this.ResponseDataExpected.Body);

                //Freddy: comparing children tokens
                if (jsonBodyReceived.Count != jsonBodyExpected.Count)
                {
                    string result = string.Format("Expected has {0} itens and and response have {1} itens", jsonBodyExpected.Count, jsonBodyReceived.Count);
                    return(result);
                }

                StringBuilder s = HelperGenericHttpTester.CompareArrays(jsonBodyExpected, jsonBodyReceived);
                return(s.ToString());
            }
            catch (Exception ex)
            {
                error = ex.Message;
                return(null);
            }
        }