public void TestSearchOptionDuplicateParameter(OptionSearchParameter parameter) { OptionManager optionHandler = new OptionManager(); List <KeyValuePair <string, string> > requestDic = new List <KeyValuePair <string, string> >(); requestDic.Add(new KeyValuePair <string, string>(parameter.ToString().ToLower(), ParameterValidValueMapper[parameter])); requestDic.Add(new KeyValuePair <string, string>(parameter.ToString().ToLower(), ParameterValidValueMapper[parameter])); var response = optionHandler.SearchOption(requestDic); PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(HttpStatusCode.BadRequest).And.ErrorCode((int)ResultCode.InvalidValue), $"Still able to search option with duplicate parameter = {parameter.ToString()}"); }
public void TestSearchOptionInjection(OptionSearchParameter parameter, InjectionInput injection) { OptionManager optionHandler = new OptionManager(); Dictionary <string, string> requestDic = new Dictionary <string, string>() { [parameter.ToString().ToLower()] = InjectionInputData.InjectionInputMapper[injection] }; try { var response = optionHandler.SearchOption(requestDic); PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(HttpStatusCode.BadRequest).And.ErrorCode((int)ResultCode.InvalidValue).Or.ErrorCode((int)ResultCode.ValueRangeExceeded), $"Still able to search option with both parameter = {parameter.ToString()} and value = {injection.ToString()}"); } catch (InvalidCastException) { var response = optionHandler.SearchOption <string>(requestDic); PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(HttpStatusCode.BadRequest).And.ErrorCode((int)ResultCode.InvalidValue).Or.ErrorCode((int)ResultCode.ValueRangeExceeded), $"Still able to search option with both parameter = {parameter.ToString()} and value = {injection.ToString()}"); } }