コード例 #1
0
        public void InvalidMethodCustomActionsUrlTest(HttpMethod httpMethod)
        {
            var hanlder  = new CustomActionManager();
            var response = hanlder.GetUrl <object>(httpMethod.ToNetHttpMethod());

            PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.NotFound), $"{httpMethod} method custom action successfully");
        }
コード例 #2
0
        public void InvalidInjectionGetUrlCustomActionTest(InjectionInput injection)
        {
            Dictionary <string, string> getUrlRequest = GetUrlRequest(InjectionInputData.InjectionInputMapper[injection]);
            var hanlder  = new CustomActionManager();
            var response = hanlder.GetUrl <ActionUrlResponse>(getUrlRequest, HttpMethod.GET.ToNetHttpMethod());

            PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.BadRequest), "Update custom action successfully");
        }
コード例 #3
0
        public void ValidReturnJsonContentTypeGetUrlCustomActionTest()
        {
            Dictionary <string, string> getUrlRequest = GetUrlRequest(PrepareData.Data.Id);
            var hanlder  = new CustomActionManager();
            var response = hanlder.GetUrl(getUrlRequest, 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");
        }
コード例 #4
0
        public void ValidGetUrlCustomActionTest()
        {
            Dictionary <string, string> getUrlRequest = GetUrlRequest(PrepareData.Data.Id);
            var hanlder  = new CustomActionManager();
            var response = hanlder.GetUrl <ActionUrlResponse>(getUrlRequest, HttpMethod.GET.ToNetHttpMethod());

            PrAssert.That(response, PrIs.SuccessfulResponse().And.HttpCode(System.Net.HttpStatusCode.OK), "Can not update custom action");
            PrAssert.That(response.Result.Url, PrIs.EqualTo(expectUrl), "The url is not as expected");
        }
コード例 #5
0
        public void InvalidGetUrlCustomActionTest(string parameterName, CustomActionTestData.InvalidValue invalidValue)
        {
            Dictionary <string, object> getUrlRequest = GetUrlRequest(PrepareData.Data.Id).ToDictionary(a => a.Key, a => (object)a.Value);

            CustomActionTestData.InvalidValueMapper[invalidValue](getUrlRequest, parameterName);
            var hanlder  = new CustomActionManager();
            var response = hanlder.GetUrl <ActionUrlResponse>(getUrlRequest.ToDictionary(a => a.Key, a => a.Value.ToString()), HttpMethod.GET.ToNetHttpMethod());

            PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.BadRequest), "Update custom action successfully");
        }
コード例 #6
0
        public void ValidDuplicateIdCustomActionTest(CustomActionTestData.DuplicateId duplicateParameter)
        {
            var deleteRequest = duplicateParameter == CustomActionTestData.DuplicateId.SameValue ?
                                new List <KeyValuePair <string, string> > {
                new KeyValuePair <string, string>("id", $"{PrepareData.Data.Id}"), new KeyValuePair <string, string>("id", $"{PrepareData.Data.Id}")
            } :
            new List <KeyValuePair <string, string> > {
                new KeyValuePair <string, string>("id", $"{PrepareData.Data.Id}"), new KeyValuePair <string, string>("id", "305")
            };
            var hanlder  = new CustomActionManager();
            var response = hanlder.GetUrl <ActionUrlResponse>(deleteRequest, HttpMethod.GET.ToNetHttpMethod());

            PrAssert.That(response, PrIs.SuccessfulResponse().And.HttpCode(System.Net.HttpStatusCode.OK), "Can not read custom action url");
            PrAssert.That(response.Result.Url, PrIs.EqualTo(expectUrl), "The url is not as expected");
        }