public void InvalidMethodSublistMenuResetLayoutTest(HttpMethod httpMethod) { var handler = new HrbcSublistManager(); var response = handler.SublistMenuResetLayout <object>(httpMethod.ToNetHttpMethod()); PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.NotFound), $"{httpMethod} method of sublist-menu-reset-layout successfully"); }
public void InvalidInjectionUpdateSublistMenuResetLayoutTest(InjectionInput injection) { var handler = new HrbcSublistManager(); var request = new Dictionary <string, string>() { ["menu_id"] = InjectionInputData.InjectionInputMapper[injection], }; var response = handler.SublistMenuResetLayout <SublistsMenuResponse>(request, HttpMethod.PUT.ToNetHttpMethod()); PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.BadRequest), "Update sublist menu reset layout"); }
public void InvalidJsonSublistMenuResetLayoutTest(InvalidSpecialCondition json) { var handler = new HrbcSublistManager(); var menuId = SublistMenuTestData.ValidMenuIdMapper[ResourceId.Client]; var requestJson = new Dictionary <string, object>() { ["menu_id"] = menuId.ToString() }.ToJson(); var response = handler.SublistMenuResetLayout <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-reset-layout successfully"); }
public void InvalidUpdateSublistMenuResetLayoutTest(SublistMenuTestData.InvalidValue invalid) { var handler = new HrbcSublistManager(); var request = new Dictionary <string, object>() { ["menu_id"] = "", }; SublistMenuTestData.InvalidValueMapper[invalid](request, "menu_id"); var response = handler.SublistMenuResetLayout <SublistsMenuResponse>(request.ToDictionary(d => d.Key, d => d.Value.ToString()), HttpMethod.PUT.ToNetHttpMethod()); PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.BadRequest), "Update sublist menu reset layout"); }
public void ValidUpdateSublistMenuResetLayoutTest(ResourceId resourceId, bool isCustomMenu) { var handler = new HrbcSublistManager(); var menuId = isCustomMenu ? SublistMenuTestData.ValidMenuIdMapper[resourceId] : SublistMenuTestData.MenuId[resourceId]; var request = new Dictionary <string, string>() { ["menu_id"] = menuId.ToString(), }; var response = handler.SublistMenuResetLayout <SublistsMenuResponse>(request, HttpMethod.PUT.ToNetHttpMethod()); PrAssert.That(response, PrIs.SuccessfulResponse().And.HttpCode(System.Net.HttpStatusCode.OK), "Can not update sublist menu reset layout"); VerifyResetLayoutResponse(handler, response); }
public void ValidReturnJsonContentTypeGetSublistMenuDefaultTest() { var handler = new HrbcSublistManager(); var menuId = SublistMenuTestData.ValidMenuIdMapper[ResourceId.Client]; var request = new Dictionary <string, string>() { ["menu_id"] = menuId.ToString(), }; var response = handler.SublistMenuResetLayout(request, HttpMethod.PUT.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 InvalidInjectionUpdateSublistMenuResetLayoutTest(DuplicateId duplicate) { var handler = new HrbcSublistManager(); var request = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("menu_id", "1") }; if (duplicate == DuplicateId.SameValue) { request.Add(new KeyValuePair <string, string>("menu_id", "1")); } else { request.Add(new KeyValuePair <string, string>("menu_id", "2")); } var response = handler.SublistMenuResetLayout <SublistsMenuResponse>(request, HttpMethod.PUT.ToNetHttpMethod()); PrAssert.That(response, PrIs.SuccessfulResponse().And.HttpCode(System.Net.HttpStatusCode.OK), "Update sublist menu reset layout"); }
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); }