Ejemplo n.º 1
0
        public void ValidDuplicateParameterUpdateSublistMenuTest(SublistMenuTestData.DuplicateUpdateSublistMenu duplicate)
        {
            var handler  = new HrbcSublistManager();
            var response = handler.SublistMenu <object>(SublistMenuTestData.ValidDuplicateSublistMenuMapper[duplicate], HttpMethod.PUT.ToNetHttpMethod());

            PrAssert.That(response, PrIs.SuccessfulResponse().And.HttpCode(System.Net.HttpStatusCode.NoContent), "Can not update sublist menu");
        }
        public void InvalidMethodSublistMenuTest(HttpMethod httpMethod)
        {
            var handler  = new HrbcSublistManager();
            var response = handler.SublistMenu <object>(httpMethod.ToNetHttpMethod());

            PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.NotFound), $"{httpMethod} method of sublist-menu successfully");
        }
Ejemplo n.º 3
0
        public void ValidLabelValueInjectionUpdateSublistMenuTest(InjectionInput injection)
        {
            var handler  = new HrbcSublistManager();
            var sublist  = SublistMenuTestData.GetSublistOfSpecificMenuId(SublistMenuTestData.MenuId[ResourceId.Client], handler);
            var request  = SublistMenuTestData.GetSublistMenuUpdateRequest(sublist.Id, SublistMenuTestData.GetSublistMenuUpdateIdFields(SublistMenuTestData.ValidFieldMapper[SublistMenuTestData.FieldsInput.SystemAllDefaultField](sublist.IdFields.Enabled)), SublistMenuTestData.GetSublistMenuUpdateLabelValue(InjectionInputData.InjectionInputMapper[injection]));
            var response = handler.SublistMenu <object>(request, HttpMethod.PUT.ToNetHttpMethod());

            PrAssert.That(response, PrIs.SuccessfulResponse().And.HttpCode(System.Net.HttpStatusCode.NoContent), "Can not update sublist menu");
        }
Ejemplo n.º 4
0
        public void InvalidIdFieldsEnableInjectionUpdateSublistMenuTest(InjectionInput injection)
        {
            var handler  = new HrbcSublistManager();
            var sublist  = SublistMenuTestData.GetSublistOfSpecificMenuId(SublistMenuTestData.MenuId[ResourceId.Client], handler);
            var request  = SublistMenuTestData.GetSublistMenuUpdateRequest(sublist.Id, SublistMenuTestData.GetSublistMenuUpdateIdFields(InjectionInputData.InjectionInputMapper[injection]), SublistMenuTestData.GetSublistMenuUpdateLabelValue(SublistMenuTestData.ValidLabelMapper[SublistMenuTestData.LabelValue.StringNoSpaceBoth]));
            var response = handler.SublistMenu <object>(request, HttpMethod.PUT.ToNetHttpMethod());

            PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.BadRequest), "Still able to update sublist menu");
        }
        public void InvalidJsonSublistMenuTest(InvalidSpecialCondition json)
        {
            var handler     = new HrbcSublistManager();
            var sublist     = SublistMenuTestData.GetSublistOfSpecificMenuId(SublistMenuTestData.MenuId[ResourceId.Client], handler);
            var requestJson = SublistMenuTestData.GetSublistMenuUpdateRequest(sublist.Id, SublistMenuTestData.GetSublistMenuUpdateIdFields(SublistMenuTestData.ValidFieldMapper[SublistMenuTestData.FieldsInput.SystemAllDefaultField](sublist.IdFields.Enabled)), SublistMenuTestData.GetSublistMenuUpdateLabelValue(SublistMenuTestData.ValidLabelMapper[SublistMenuTestData.LabelValue.StringNoSpaceBoth])).ToJson();
            var response    = handler.SublistMenu <object>(SublistMenuTestData.InvalidBodyJsonTestCasesMapper[json](requestJson), HttpMethod.PUT.ToNetHttpMethod());

            PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.BadRequest), $"Send {json} with api sublist-menu successfully");
        }
Ejemplo n.º 6
0
        public void InvalidIdFieldsEnableUpdateSublistMenuTest(string param, SublistMenuTestData.InvalidValue invalidValue)
        {
            var handler   = new HrbcSublistManager();
            var sublist   = SublistMenuTestData.GetSublistOfSpecificMenuId(SublistMenuTestData.MenuId[ResourceId.Client], handler);
            var enableDic = new Dictionary <string, object> {
                ["enabled"] = SublistMenuTestData.ValidFieldMapper[SublistMenuTestData.FieldsInput.SystemAllDefaultField](sublist.IdFields.Enabled)
            };

            SublistMenuTestData.InvalidValueMapper[invalidValue](enableDic, param);
            var request  = SublistMenuTestData.GetSublistMenuUpdateRequest(sublist.Id, enableDic, SublistMenuTestData.GetSublistMenuUpdateLabelValue(SublistMenuTestData.ValidLabelMapper[SublistMenuTestData.LabelValue.StringNoSpaceBoth]));
            var response = handler.SublistMenu <object>(request, HttpMethod.PUT.ToNetHttpMethod());

            PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.BadRequest), "Still able to update sublist menu");
        }
Ejemplo n.º 7
0
        public void ValidUpdateSublistMenuTest(ResourceId resourceId, bool isCustomMenu, SublistMenuTestData.FieldsInput fieldsInput, SublistMenuTestData.LabelValue labelValue)
        {
            var handler  = new HrbcSublistManager();
            var menuId   = isCustomMenu ? SublistMenuTestData.ValidMenuIdMapper[resourceId] : SublistMenuTestData.MenuId[resourceId];
            var sublist  = SublistMenuTestData.GetSublistOfSpecificMenuId(menuId, handler);
            var request  = SublistMenuTestData.GetSublistMenuUpdateRequest(sublist.Id, SublistMenuTestData.GetSublistMenuUpdateIdFields(SublistMenuTestData.ValidFieldMapper[fieldsInput](sublist.IdFields.Enabled)), SublistMenuTestData.GetSublistMenuUpdateLabelValue(SublistMenuTestData.ValidLabelMapper[labelValue]));
            var response = handler.SublistMenu <object>(request, HttpMethod.PUT.ToNetHttpMethod());

            PrAssert.That(response, PrIs.SuccessfulResponse().And.HttpCode(System.Net.HttpStatusCode.NoContent), "Can not update sublist menu");
            var sublists = handler.SublistsMenu <SublistsMenuResponse>(new Dictionary <string, string> {
                ["menu_id"] = menuId.ToString()
            }, HttpMethod.GET.ToNetHttpMethod());
            var specificSublist = sublists.Result.Values.Where(value => value.Value.Id == sublist.Id).Select(dic => dic.Value).SingleOrDefault();

            PrAssert.That(specificSublist.Label.EnUs.Value, PrIs.EqualTo(SublistMenuTestData.ValidLabelMapper[labelValue]), "Value of en_us is not as expected");
            PrAssert.That(specificSublist.Label.Ja.Value, PrIs.EqualTo(SublistMenuTestData.ValidLabelMapper[labelValue]), "Value of ja is not as expected");
            PrAssert.That(specificSublist.IdFields.Enabled, PrIs.EqualTo(SublistMenuTestData.ValidFieldMapper[fieldsInput](sublist.IdFields.Enabled)), "Value of enable is not as expected");
        }