public void InvalidJsonSublistMenuDefaultTest(InvalidSpecialCondition json)
        {
            var handler     = new HrbcSublistManager();
            var sublist     = SublistMenuTestData.GetSublistOfSpecificMenuId(SublistMenuTestData.MenuId[ResourceId.Client], handler);
            var requestJson = SublistMenuTestData.GetSublistMenuDefaultRequest(sublist.Id, SublistMenuTestData.ValidUnixTimeStamp).ToDictionary(r => r.Key, r => (object)r.Value).ToJson();
            var response    = handler.SublistMenuDefault <object>(SublistMenuTestData.InvalidBodyJsonTestCasesMapper[json](requestJson), HttpMethod.GET.ToNetHttpMethod());

            PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.BadRequest), $"Send {json} with api sublist-menu-default successfully");
        }
        public void ValidReturnJsonContentTypeGetSublistMenuDefaultTest()
        {
            var handler  = new HrbcSublistManager();
            var sublist  = SublistMenuTestData.GetSublistOfSpecificMenuId(SublistMenuTestData.MenuId[ResourceId.Client], handler);
            var request  = SublistMenuTestData.GetSublistMenuDefaultRequest(sublist.Id, SublistMenuTestData.ValidUnixTimeStamp);
            var response = handler.SublistMenuDefault(request, HttpMethod.GET.ToNetHttpMethod());

            PrAssert.That(response.IsSuccessStatusCode, "Can not update custom action");
            PrAssert.That(response.Content.Headers.ContentType.MediaType, PrIs.EqualTo("application/json"), "The content type is not as expected");
        }
        public void InvalidGetSublistMenuDefaultTest(string param, SublistMenuTestData.InvalidValue invalidValue)
        {
            var handler = new HrbcSublistManager();
            var sublist = SublistMenuTestData.GetSublistOfSpecificMenuId(SublistMenuTestData.MenuId[ResourceId.Client], handler);
            var request = SublistMenuTestData.GetSublistMenuDefaultRequest(sublist.Id, SublistMenuTestData.ValidUnixTimeStamp).ToDictionary(r => r.Key, r => (object)r.Value);

            SublistMenuTestData.InvalidValueMapper[invalidValue](request, param);
            var response = handler.SublistMenuDefault <SublistMenuDefaultResponse>(request.ToDictionary(r => r.Key, r => r.Value.ToString()), HttpMethod.GET.ToNetHttpMethod());

            PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.BadRequest), "Receive sublist menu default");
        }
        public void ValidGetSublistMenuDefaultTest(ResourceId resourceId, bool isCustomMenu, SublistMenuTestData.ValidUnderScope validUnderScope)
        {
            var handler = new HrbcSublistManager();
            var sublist = SublistMenuTestData.GetSublistOfSpecificMenuId(isCustomMenu ? SublistMenuTestData.ValidMenuIdMapper[resourceId] : SublistMenuTestData.MenuId[resourceId], handler);
            var request = SublistMenuTestData.GetSublistMenuDefaultRequest(sublist.Id, SublistMenuTestData.ValidUnixTimeStamp);

            SublistMenuTestData.ValidUnderScopeMapper[validUnderScope](request);
            var response = handler.SublistMenuDefault <SublistMenuDefaultResponse>(request, HttpMethod.GET.ToNetHttpMethod());

            PrAssert.That(response, PrIs.SuccessfulResponse().And.HttpCode(System.Net.HttpStatusCode.OK), "Can not get sublist menu default");
        }
Esempio n. 5
0
 private static void VerifyResetLayoutResponse(HrbcSublistManager handler, PrivateApiResponse <SublistsMenuResponse> resetResponse)
 {
     foreach (var key in resetResponse.Result.Values.Keys)
     {
         var sublistRequest  = SublistMenuTestData.GetSublistMenuDefaultRequest(resetResponse.Result.Values[key].Id, SublistMenuTestData.ValidUnixTimeStamp);
         var sublistResponse = handler.SublistMenuDefault <SublistMenuDefaultResponse>(sublistRequest, HttpMethod.GET.ToNetHttpMethod());
         PrAssume.That(sublistResponse, PrIs.SuccessfulResponse(), "Can not get sublist menu default");
         foreach (var field in resetResponse.Result.Values[key].IdFields.Enabled)
         {
             PrAssert.That(sublistResponse.Result.IdFields.Enabled.Contains(field), "Response not contains the expected fields");
         }
     }
 }
        public void ValidDuplicateGetSublistMenuDefaultTest(SublistMenuTestData.DuplicateGetSublistMenuDefault duplicateGet)
        {
            var handler  = new HrbcSublistManager();
            var menuId   = SublistMenuTestData.MenuId[ResourceId.Client];
            var sublists = handler.SublistsMenu <SublistsMenuResponse>(new Dictionary <string, string> {
                ["menu_id"] = menuId.ToString()
            }, HttpMethod.GET.ToNetHttpMethod());

            PrAssume.That(sublists, PrIs.SuccessfulResponse());
            var sublist      = sublists.Result.Values.FirstOrDefault().Value;
            var validRequest = SublistMenuTestData.GetSublistMenuDefaultRequest(sublist.Id, SublistMenuTestData.ValidUnixTimeStamp);
            var request      = validRequest.ToList();

            SublistMenuTestData.ValidDuplicateSublistMenuDefaultMapper[duplicateGet](request, sublist.Id.ToString(), sublists.Result.Values.LastOrDefault().Value.Id.ToString(), "1536741227");
            var response = handler.SublistMenuDefault <SublistMenuDefaultResponse>(request, HttpMethod.GET.ToNetHttpMethod());

            PrAssert.That(response, PrIs.SuccessfulResponse().And.HttpCode(System.Net.HttpStatusCode.OK), "Can not get sublist menu default");
        }