Exemple #1
0
        /// <summary>
        /// Compare expected headers
        /// </summary>
        public HeadersTestResult CompareHeaders(out string error)
        {
            //todo fazer loop em cima do response.headers.
            error = null;

            HeadersTestResult headersTestResult = HelperGenericHttpTester.CompareHeaders(this.ResponseDataExpected, this.ResponseDataReceived, out error);

            return(headersTestResult);
        }
Exemple #2
0
        public string CompareBody(out string error)
        {
            error = null;
            try
            {
                JObject jsonBodyReceived = JObject.Parse(this.ResponseDataReceived.Body);
                JObject jsonBodyExpected = JObject.Parse(this.ResponseDataExpected.Body);

                StringBuilder s = HelperGenericHttpTester.CompareObjects(jsonBodyExpected, jsonBodyReceived);
                return(s.ToString());
            }
            catch (Exception ex)
            {
                error = ex.Message;
                return(null);
            }
        }
Exemple #3
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);
            }
        }