Example #1
0
        public static string DuplicatedPutRequestNotSameValue(ActionMenuEndpointType type, Params param)
        {
            var request = new Dictionary <Params, string>();

            switch (type)
            {
            case ActionMenuEndpointType.PutActionMenuLayout:
                request[Params.MenuId]           = "{\"menuId\": 1, \"menuId\": 2, \"actionMenuId\": 32, \"modified\": [{ \"id\": 199, \"parentId\": 0, \"position\": 0, \"enabled\": 0 }] }";
                request[Params.ActionMenuId]     = "{\"menuId\": 1, \"actionMenuId\": 8, \"actionMenuId\": 26, \"modified\": [{ \"id\": 171, \"parentId\": 0, \"position\": 1, \"enabled\": 0 }] }";
                request[Params.Modified]         = "{\"menuId\": 1, \"actionMenuId\": 8, \"modified\": [{ \"id\": 171, \"parentId\": 0, \"position\": 2, \"enabled\": 0 }], \"modified\": [{ \"id\": 722, \"parentId\": 3, \"position\": 1, \"enabled\": 1 }] }";
                request[Params.ModifiedId]       = "{\"menuId\": 1, \"actionMenuId\": 1, \"modified\": [{ \"id\": 13, \"id\": 14, \"parentId\": 0, \"position\": 4, \"enabled\": 0 }] }";
                request[Params.ModifiedParentId] = "{\"menuId\": 1, \"actionMenuId\": 26, \"modified\": [{ \"id\": 13, \"parentId\": 0, \"parentId\": 1, \"position\": 5, \"enabled\": 0 }] }";
                request[Params.ModifiedPosition] = "{\"menuId\": 1, \"actionMenuId\": 27, \"modified\": [{ \"id\": 13, \"parentId\": 0, \"position\": 6, \"position\": 7, \"enabled\": 0 }] }";
                request[Params.ModifiedEnabled]  = "{\"menuId\": 1, \"actionMenuId\": 28, \"modified\": [{ \"id\": 13, \"parentId\": 0, \"position\": 8, \"enabled\": 0, \"enabled\": 1 }] }";
                break;

            case ActionMenuEndpointType.PutActionMenuLabel:
                request[Params.LocalizedTextId] = "{\"localizedTextId\": \"id_am_content_26\", \"localizedTextId\": \"id_am_content_27\", \"label\": {\"en_us\": {\"value\": \"Test Update Label\"}}}";
                request[Params.Label]           = "{\"localizedTextId\": \"id_am_content_40\", \"label\": {\"en_us\": {\"value\": \"Test Update Label\"}}, \"label\": {\"ja\": {\"value\": \"Detail Update\"}}}";
                request[Params.En_us]           = "{\"localizedTextId\": \"id_am_content_41\", \"label\": {\"en_us\": {\"value\": \"Test Update Label\"}}, \"en_us\": {\"default\": \"Detail Update\"}}}";
                request[Params.Ja]      = "{\"localizedTextId\": \"id_am_content_42\", \"label\": {\"ja\": {\"value\": \"Test Update Label\"}, \"ja\": {\"default\": \"Detail Update\"}}}";
                request[Params.EnValue] = "{\"localizedTextId\": \"id_am_content_43\", \"label\": {\"en_us\": {\"value\": \"Test Update Label\", \"value\": \"Detail Update Label\"}}}";
                request[Params.JaValue] = "{\"localizedTextId\": \"id_am_content_44\", \"label\": {\"ja\": {\"value\": \"Test Update Label\", \"value\": \"Detail Update Label\"}}}";
                break;

            default:
                break;
            }
            return(request[param]);
        }
        public void AccessEndpointTests(ActionMenuEndpointType endpoint, AccessState accessState, HttpStatusCode httpStatusCode, ResultCode resultCode)
        {
            AccessEndpointManager accessEndpointHandler = new AccessEndpointManager();
            var accessEndpoint = EndpointMapper[endpoint];
            var response       = accessEndpointHandler.AccessEndpoint <object>(accessState, accessEndpoint, endpoint.ToString().Contains("Get") ? HttpMethod.Get : HttpMethod.Put);

            PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(httpStatusCode).And.ErrorCode((int)resultCode));
        }
Example #3
0
        public static Dictionary <string, object> DefaultPutRequest(ActionMenuEndpointType actionMenuType)
        {
            var request = new Dictionary <string, object>()
            {
                [actionMenuType == ActionMenuEndpointType.PutActionMenuReset ? "menu_id": "menuId"] = 1,
                [actionMenuType == ActionMenuEndpointType.PutActionMenuReset ? "action_menu_id": "actionMenuId"] = 1,
            };

            if (actionMenuType == ActionMenuEndpointType.PutActionMenuLayout)
            {
                request["modified"] = new List <Dictionary <string, int> >()
                {
                    new Dictionary <string, int>()
                    {
                        ["id"]       = 1,
                        ["parentId"] = 0,
                        ["position"] = 0,
                        ["enabled"]  = 1
                    },
                };
            }
            else if (actionMenuType == ActionMenuEndpointType.PutActionMenuLabel)
            {
                request.Clear();
                request["localizedTextId"] = "id_am_content_1";
                request["label"]           = new Dictionary <string, object>()
                {
                    ["en_us"] = new Dictionary <string, string>()
                    {
                        ["value"] = "Detail Update"
                    },
                    ["ja"] = new Dictionary <string, string>()
                    {
                        ["value"] = "Detail Update"
                    }
                };
            }

            return(request);
        }