public static Dictionary <string, object> GenerateFieldLayoutMultipleCellsRequest(ResourceId resource, Guid uuid, Title title, LayoutRowColumn layoutRowColumn, CellContent cellContent, Axis axisX, Axis axisY) { var props = new Dictionary <string, object>(); TitleMapperValue[title](props); LayoutRowColumnMapperValue[layoutRowColumn](props); var CellContent1 = new Dictionary <string, object> { [Cell.Rows.GetEnumStringValue()] = 1, [Cell.Cols.GetEnumStringValue()] = 1, [Cell.X.GetEnumStringValue()] = 1, [Cell.Y.GetEnumStringValue()] = 1, [Cell.Content.GetEnumStringValue()] = new Dictionary <string, object> { [cellContent.GetEnumStringValue()] = uuid.ToString() } }; var CellContent2 = new Dictionary <string, object>(CellContent1); AxisMapperValue[axisX](CellContent1, Cell.X.GetEnumStringValue()); AxisMapperValue[axisY](CellContent1, Cell.Y.GetEnumStringValue()); props[Parameters.Cells.GetEnumStringValue()] = new List <Dictionary <string, object> > { CellContent1, CellContent2 }; return(new Dictionary <string, object> { [Parameters.Create.GetEnumStringValue()] = props, [Parameters.Screen.GetEnumStringValue()] = (int)resource }); }
public static Dictionary <string, object> GenerateFieldLayoutRequest(ResourceId resource, Guid uuid, Title title, Row row, Column col, CellContent cellContent) { var props = new Dictionary <string, object>(); TitleMapperValue[title](props); RowMapperValue[row](props); ColumnMapperValue[col](props); props[Parameters.Cells.GetEnumStringValue()] = new List <Dictionary <string, object> > { new Dictionary <string, object> { [Cell.Rows.GetEnumStringValue()] = 1, [Cell.Cols.GetEnumStringValue()] = 1, [Cell.X.GetEnumStringValue()] = 1, [Cell.Y.GetEnumStringValue()] = 1, [Cell.Content.GetEnumStringValue()] = new Dictionary <string, object> { [cellContent.GetEnumStringValue()] = uuid.ToString() } } }; return(new Dictionary <string, object> { [Parameters.Create.GetEnumStringValue()] = props, [Parameters.Screen.GetEnumStringValue()] = (int)resource }); }
public void TestInvalidCreateFieldLayoutByCellContent(CellContent param, InvalidValue invalid) { var handler = new DefaultManager(); var fieldUuid = FieldsCreator.Data[$"{ResourceId.Client}-{FieldType.SingleLineText.ToString()}-0"].Guid; var request = GenerateFieldLayoutRequest(ResourceId.Client, fieldUuid, Title.MinJa, Row.Min, Column.Min, CellContent.Field); var createParam = request[Parameters.Create.GetEnumStringValue()] as Dictionary <string, object>; var cells = (createParam[Parameters.Cells.GetEnumStringValue()] as List <Dictionary <string, object> >).First(); var cellContent = cells[Cell.Content.GetEnumStringValue()] as Dictionary <string, object>; InvalidValueMapper[invalid](cellContent, param.GetEnumStringValue()); createParam[Parameters.Cells.GetEnumStringValue()] = cellContent; request[Parameters.Create.GetEnumStringValue()] = createParam; var response = handler.Send <object>(FieldManager.FieldLayoutApiRelativeUrl, JsonConvert.SerializeObject(request), HttpMethod.POST); PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.BadRequest)); }
public void TestInvalidUpdateFieldLayoutByCellContentInjection(CellContent param, Enums.InvalidInjection invalid) { var handler = new DefaultManager(); var fieldUuid = FieldsCreator.Data[$"{ResourceId.Client}-{FieldType.SingleLineText.ToString()}-0"].Guid; var request = GenerateUpdateFieldLayoutRequest(ResourceId.Client, LayoutUuids[ResourceId.Client], FieldUuids[ResourceId.Client], Title.MinJa, UpdateCellLayout.MinX, UpdateCellContent.Field); var updateParam = request[UpdateParameters.Update.GetEnumStringValue()] as Dictionary <string, object>; var uuidParam = updateParam[LayoutUuids[ResourceId.Client].ToString()] as Dictionary <string, object>; var cells = (uuidParam[Parameters.Cells.GetEnumStringValue()] as List <Dictionary <string, object> >).First(); var cellContent = cells[Cell.Content.GetEnumStringValue()] as Dictionary <string, object>; cellContent.Remove(CellContent.Field.GetEnumStringValue()); cellContent[param.GetEnumStringValue()] = MapperData.InvalidInjectionMapper[invalid]; cells[Cell.Content.GetEnumStringValue()] = cellContent; uuidParam[Parameters.Cells.GetEnumStringValue()] = new List <Dictionary <string, object> > { cells }; updateParam[LayoutUuids[ResourceId.Client].ToString()] = uuidParam; request[UpdateParameters.Update.GetEnumStringValue()] = updateParam; var response = handler.Send <object>(FieldManager.FieldLayoutApiRelativeUrl, JsonConvert.SerializeObject(request), HttpMethod.PUT); PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.BadRequest)); }