public void TestOptionSearchDuplicateParameters(Parameters parameter, DuplicateTypes inputType)
        {
            var optionSearchHandler = new OptionSearchManager();
            var response            = optionSearchHandler.OptionSearch <OptionSearchAliasResponse>(DuplicateOptionData[parameter](inputType), System.Net.Http.HttpMethod.Post);

            PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.BadRequest));
        }
        public void TestOptionSearchInvalidBodyJson(InvalidSpecialCondition inputType)
        {
            var optionSearchHandler = new OptionSearchManager();
            var response            = optionSearchHandler.OptionSearch <OptionSearchAliasResponse>(InvalidEntrySpecialTestCasesMapper[inputType].ToString(), System.Net.Http.HttpMethod.Post);

            PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.BadRequest));
        }
        public void UpdateMappingByOtherHttpMethod(HttpMethod inputType)
        {
            var request             = GetOptionSearchParameters("Option.P_RecruiterPhase");
            var optionSearchHandler = new OptionSearchManager();
            var response            = optionSearchHandler.OptionSearch <OptionSearchAliasResponse>(request, inputType.ToNetHttpMethod());

            PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.BadRequest));
        }
        public void TestOptionSearchInvalidSpecial(SpecialTestCases inputType)
        {
            var request             = GetOptionSearchParameters(InvalidSpecialMap[inputType]());
            var optionSearchHandler = new OptionSearchManager();
            var response            = optionSearchHandler.OptionSearch <OptionSearchAliasResponse>(request, System.Net.Http.HttpMethod.Post, inputType == SpecialTestCases.WrongContentType ? "text/html" : "application/json");

            PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.BadRequest));
        }
Example #5
0
        public void TestOptionSearchDataChildSystemValid(ValidOptionSearchDataChildSystemTestCases inputType)
        {
            var optionSearchHandler = new OptionSearchManager();
            var response            = optionSearchHandler.OptionSearch <OptionSearchAliasResponse>(GetOptionSearchParameters(inputType.ToString()), HttpMethod.Post);

            PrAssert.That(response, PrIs.SuccessfulResponse().And.HttpCode(System.Net.HttpStatusCode.OK));
            PrAssert.That(response.Result.Total, PrIs.Not.Null.And.EqualTo(response.Result.Result.Count));
            VerifyOptionData(response.Result.Result, inputType.ToString());
        }
Example #6
0
        public void TestOptionUserDefineSearch(OptionNestingType optionNestingType)
        {
            var aliasOption         = optionNestingType == OptionNestingType.Parent ? ParentOptionWithChild : ChildOptionAlias.Split('.')[1];
            var optionSearchHandler = new OptionSearchManager();
            var response            = optionSearchHandler.OptionSearch <OptionSearchAliasResponse>(GetOptionSearchParameters(aliasOption), HttpMethod.Post);

            PrAssert.That(response, PrIs.SuccessfulResponse().And.HttpCode(System.Net.HttpStatusCode.OK));
            PrAssert.That(response.Result.Total, PrIs.Not.Null.And.EqualTo(response.Result.Result.Count));
            VerifyOptionData(response.Result.Result, aliasOption);
        }
        public void TestOptionSearchInjection(Parameters parameter, InjectionInput inputType)
        {
            var request = GetOptionSearchParameters(InjectionInputData.InjectionInputMapper[inputType]);

            if (parameter == Parameters.W)
            {
                request["w"] = InjectionInputData.InjectionInputMapper[inputType].ToString();
            }
            var optionSearchHandler = new OptionSearchManager();
            var response            = optionSearchHandler.OptionSearch <OptionSearchAliasResponse>(request, System.Net.Http.HttpMethod.Post);

            PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.BadRequest));
        }
        public void TestOptionSearchInvalid(Parameters parameter, InvalidTestCases inputType)
        {
            var request = GetOptionSearchParameters(InvalidOptionMap[inputType](parameter).ToString());

            if (parameter == Parameters.W)
            {
                request["w"] = InvalidOptionMap[inputType](parameter).ToString();
            }
            var optionSearchHandler = new OptionSearchManager();
            var response            = optionSearchHandler.OptionSearch <OptionSearchAliasResponse>(inputType == InvalidTestCases.Missing ? InvalidOptionMap[inputType](parameter) : request, System.Net.Http.HttpMethod.Post);

            PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.BadRequest));
        }
Example #9
0
        private static Dictionary <string, OptionGetResponse.Options> GetOptionByUuid(List <string> uuid)
        {
            var request = new Dictionary <string, object>()
            {
                ["id"] = uuid,
                ["s"]  = new List <string> {
                    "parent", "alias"
                }
            };
            var optionSearchHandler = new OptionSearchManager("/privateapi/schema/option/method/get");
            var response            = optionSearchHandler.OptionSearch <OptionGetResponse>(request, HttpMethod.Post);

            PrAssume.That(response, PrIs.SuccessfulResponse(), "Cannot get option");
            return(response.Result.Values);
        }