public void ThenIVerifyResponseHasParameterWithTheValueTo(string parameterToBeChecked, string compareCondition, string expectedParameterValue) { //Get the actual parameter value in the response from the deserialzed response object //Used GetType and GetProperty method to make implementation generic irrespective of the parameter passed for verification. string actualElementValue = deserializedProduct.GetType().GetProperty(parameterToBeChecked).GetValue(deserializedProduct).ToString(); //Comparing actual value of the response with expected value Assert.IsTrue(VerifyAPIResponse.VerifyParameterValue(expectedParameterValue, compareCondition, actualElementValue)); }
public void WhenIVerifyResponseHasListitemWithOneItemHavingWithAndValues(string listObject, string parameterList, string compareConditions, string expectedParameterValues) { //Get the list object in the response from the deserialzed response object object elementListObj = deserializedProduct.GetType().GetProperty(listObject).GetValue(deserializedProduct); //Converting list object into a generic object List <object> result = ((IEnumerable)elementListObj).Cast <object>().ToList(); //Comparing actual value of the required parameters in the response with their expected values Assert.IsTrue(VerifyAPIResponse.VerifyParameterListValue(listObject, result.ToArray(), parameterList, compareConditions, expectedParameterValues)); }