Exemplo n.º 1
0
        public static OpenAPICases[] CompareCases(OpenAPICases[] Cases)
        {
            string expectedStr;
            string actualStr;

            string tmpExpectedStr;
            string tmpActualStr;

            CompareReport report = new CompareReport();
            bool          isOutResult;

            for (int i = 0; i < Cases.Length; i++)
            {
                expectedStr = Cases[i].expectedResponseBody;
                actualStr   = Cases[i].actualResponseBody;

                if (Cases[i].url.Contains("Aggregate") || Cases[i].url.Contains("Ranking") || Cases[i].requestBody.Contains("RankingType"))
                {
                    tmpExpectedStr = ConvertJson.String2Json(expectedStr);
                    tmpActualStr   = ConvertJson.String2Json(actualStr);

                    expectedStr = FilterStrings(tmpExpectedStr);
                    actualStr   = FilterStrings(tmpActualStr);
                }

                report = CompareEnergyUseResponseBody(expectedStr, actualStr, out isOutResult);

                if (true == isOutResult)
                {
                    Cases[i].result = "Pass:"******"Fail:" + report.errorMessage;
                }
                Cases[i].resultReport = report.detailedInfo;
            }
            return(Cases);
        }