Exemple #1
0
        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()}");
            }
        }