public void InvalidMethodSublistsMenuLazyTest(HttpMethod httpMethod)
        {
            var handler  = new HrbcSublistManager();
            var response = handler.SublistsMenuLazy <object>(httpMethod.ToNetHttpMethod());

            PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.NotFound), $"{httpMethod} method of sublists-menu-lazy successfully");
        }
Пример #2
0
        public void InvalidInjectionGetSublistsMenuLazyTest(InjectionInput injection)
        {
            var handler = new HrbcSublistManager();
            var request = new Dictionary <string, string>()
            {
                ["menu_id"] = InjectionInputData.InjectionInputMapper[injection],
            };
            var response = handler.SublistsMenuLazy <SublistsMenuLazyResponse>(request, HttpMethod.GET.ToNetHttpMethod());

            PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.BadRequest), "Get sublists menu");
        }
        public void InvalidJsonSublistsMenuLazyTest(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.SublistsMenuLazy <object>(SublistMenuTestData.InvalidBodyJsonTestCasesMapper[json](requestJson), HttpMethod.GET.ToNetHttpMethod());

            PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.BadRequest), $"Send {json} with api sublists-menu-lazy successfully");
        }
Пример #4
0
        public void ValidGetSublistsMenuLazyTest(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.SublistsMenuLazy <SublistsMenuLazyResponse>(request, HttpMethod.GET.ToNetHttpMethod());

            PrAssert.That(response, PrIs.SuccessfulResponse().And.HttpCode(System.Net.HttpStatusCode.OK), "Can not get sublists menu");
        }
Пример #5
0
        public void InvalidMenuIdGetSublistsMenuLazyTest(SublistMenuTestData.InvalidValue invalid)
        {
            var handler = new HrbcSublistManager();
            var request = new Dictionary <string, object>()
            {
                ["menu_id"] = "",
            };

            SublistMenuTestData.InvalidValueMapper[invalid](request, "menu_id");
            var response = handler.SublistsMenuLazy <SublistsMenuLazyResponse>(request.ToDictionary(d => d.Key, d => d.Value.ToString()), HttpMethod.GET.ToNetHttpMethod());

            PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.BadRequest), "Get sublists menu");
        }
Пример #6
0
        public void ValidReturnJsonContentTypeGetSublistsMenuLazyTest()
        {
            var handler = new HrbcSublistManager();
            var menuId  = SublistMenuTestData.MenuId[ResourceId.Client];
            var request = new Dictionary <string, string>()
            {
                ["menu_id"] = menuId.ToString(),
            };
            var response = handler.SublistsMenuLazy(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");
        }
Пример #7
0
        public void ValidDuplicateGetSublistsMenuLazyTest(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.SublistsMenuLazy <SublistsMenuLazyResponse>(request, HttpMethod.GET.ToNetHttpMethod());

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