Example #1
0
        public void ValidLayoutSpecialGetSublistsMenuTest(ResourceId resourceId, bool isCustomMenu, SublistMenuTestData.EnableDisableValue enabledisable)
        {
            var handler = new HrbcSublistManager();
            var menuId  = isCustomMenu ? SublistMenuTestData.ValidMenuIdMapper[resourceId] : SublistMenuTestData.MenuId[resourceId];
            var request = SublistMenuTestData.GetSublistMenuLayoutRequest(menuId, new List <int>(), new List <int>());

            SublistMenuTestData.ValidEnableDisableMapper[enabledisable](request, CurrentSublist.Data[menuId].Select(value => value.Id).ToList());
            var response = handler.SublistMenuLayout <object>(request, HttpMethod.PUT.ToNetHttpMethod());

            PrAssume.That(response, PrIs.SuccessfulResponse(), "Can not update sublist menu layout");
            var getRequest = new Dictionary <string, string>()
            {
                ["menu_id"] = menuId.ToString()
            };
            var sublists = handler.SublistsMenu <SublistsMenuResponse>(getRequest, HttpMethod.GET.ToNetHttpMethod());

            PrAssert.That(sublists, PrIs.SuccessfulResponse().And.HttpCode(System.Net.HttpStatusCode.OK), "Can not get sublists menu");
            var resultEnableList  = sublists.Result.Values.Where(v => v.Value.Enabled == 1).Select(value => value.Value.Id);
            var resultDisableList = sublists.Result.Values.Where(v => v.Value.Enabled == 0).Select(value => value.Value.Id);

            foreach (var item in (IEnumerable <int>)request["enabled"])
            {
                PrAssert.That(resultEnableList.Contains(item), "enabled is not as expected");
            }
            foreach (var item in (IEnumerable <int>)request["disabled"])
            {
                PrAssert.That(resultDisableList.Contains(item), "disabled is not as expected");
            }
        }
Example #2
0
        public void InvalidIdUpdateSublistMenuLayoutTest(SublistMenuTestData.InvalidValue invalidValue, SublistMenuTestData.EnableDisableValue enabledisable)
        {
            var handler = new HrbcSublistManager();
            var menuId  = SublistMenuTestData.ValidMenuIdMapper[ResourceId.Client];
            var request = SublistMenuTestData.GetSublistMenuLayoutRequest(menuId, new List <int>(), new List <int>());

            SublistMenuTestData.ValidEnableDisableMapper[enabledisable](request, CurrentSublist.Data[menuId].Select(value => value.Id).ToList());
            SublistMenuTestData.InvalidValueMapper[invalidValue](request, "menuId");
            var response = handler.SublistMenuLayout <object>(request, HttpMethod.PUT.ToNetHttpMethod());

            PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.BadRequest), "Still able to update sublist menu layout");
        }
Example #3
0
        public void ValidSpecialUpdateSublistMenuResetLayoutTest(ResourceId resourceId, bool isCustomMenu, SublistMenuTestData.EnableDisableValue enabledisable)
        {
            var handler = new HrbcSublistManager();
            var menuId  = isCustomMenu ? SublistMenuTestData.ValidMenuIdMapper[resourceId] : SublistMenuTestData.MenuId[resourceId];
            var request = SublistMenuTestData.GetSublistMenuLayoutRequest(menuId, new List <int>(), new List <int>());

            SublistMenuTestData.ValidEnableDisableMapper[enabledisable](request, CurrentSublist.Data[menuId].Select(value => value.Id).ToList());
            var response = handler.SublistMenuLayout <object>(request, HttpMethod.PUT.ToNetHttpMethod());

            PrAssume.That(response, PrIs.SuccessfulResponse(), "Can not update sublist menu layout");
            var resetRequest = new Dictionary <string, string>()
            {
                ["menu_id"] = menuId.ToString(),
            };
            var resetResponse = handler.SublistMenuResetLayout <SublistsMenuResponse>(resetRequest, HttpMethod.PUT.ToNetHttpMethod());

            PrAssert.That(response, PrIs.SuccessfulResponse().And.HttpCode(System.Net.HttpStatusCode.OK), "Can not update sublist menu reset layout");
            VerifyResetLayoutResponse(handler, resetResponse);
        }
Example #4
0
        public void ValidUpdateSublistMenuLayoutTest(ResourceId resourceId, bool isCustomMenu, SublistMenuTestData.EnableDisableValue enabledisable)
        {
            var handler = new HrbcSublistManager();
            var menuId  = isCustomMenu ? SublistMenuTestData.ValidMenuIdMapper[resourceId] : SublistMenuTestData.MenuId[resourceId];
            var request = SublistMenuTestData.GetSublistMenuLayoutRequest(menuId, new List <int>(), new List <int>());

            SublistMenuTestData.ValidEnableDisableMapper[enabledisable](request, CurrentSublist.Data[menuId].Select(value => value.Id).ToList());
            var response = handler.SublistMenuLayout <object>(request, HttpMethod.PUT.ToNetHttpMethod());

            PrAssert.That(response, PrIs.SuccessfulResponse().And.HttpCode(System.Net.HttpStatusCode.NoContent), "Can not update sublist menu layout");
        }