小编Ayu*_*yal的帖子

JSON_MODIFY 在“/”前面添加额外的“\”

我正在尝试使用 SQL Server 中内置的 JSON 函数在现有 JSON 中插入一个值。

现有的 JSON:

{
  "array": [
    {
      "type": "_api",
      "content": {
        "acId": "sometext/567890"
      }
    }
  ]
}


SET @JSONData = JSON_MODIFY(@JSONData,'$.array[0].content.uId ', 'sometext/1234/locations/1234')  
Run Code Online (Sandbox Code Playgroud)

但是插入 JSON 的结果值如下所示。

我需要它来, sometext/1234/locations/1234但它被添加为sometext\/1234\/locations\/1234

{
  "array": [
    {
      "type": "_api",
      "content": {
        "acId": "sometext/567890",
        "uId": "sometext\/1234\/locations\/1234"
      }
    }
  ]
}
Run Code Online (Sandbox Code Playgroud)

sql t-sql sql-server json

7
推荐指数
1
解决办法
2012
查看次数

如何在C#中单元测试Textrenderer.DrawText方法

public static void DrawText(IDeviceContext dc, string text, Font font, Point pt, Color foreColor, TextFormatFlags flags);
Run Code Online (Sandbox Code Playgroud)

我有一个测试器应用程序,用于我的ExtendedComboBox.以下代码中给出的所有String项目都存在于我的测试器应用程序中的ComboBox项目中.如何对上述方法进行单元测试,因为它返回void?测试TextRenderer.Drawtext的另一种方法是什么?是否有任何替代测试OnDrawItem方法来绘制ComboBox文本.

[TestMethod()]
public void ExtendedComboBoxOnDrawPrefixTest()
{
    ExtendedComboBox cboTest = new ExtendedComboBox ();

    // List of strings having special characters.

    string[] items = { 
        "&One",
        "T&wo",
        "E!xclamation",
        "Am@persat",
        "H#ash",
        "Dollar$Sign",
        "Perc%ent",
        "Ci^rcumflex",
        "Ast*erisk",
        "Hy-phen",
        "Und_erscore",
        "pl+us",
        "Equ=als",
        "Col:on",
        "Semi;colon",
        "Co'mma",
        "Inverted\"Comma",
        "Apos'trophe",
        "Pip|e",
        "Open{Brace",
        "Close}Brace",
        "OpenBr[acket",
        "CloseBr]acket",
        "BackS\\lash",
        "ForwardSl/ash",
        "LessT<han",
        "Greate>rThan",
        "Questio?nMark",
        "Do.t",
        "Three",
        "Four",
        "Five",
        "Six",
        "This is a really extremely long string value for …
Run Code Online (Sandbox Code Playgroud)

c# unit-testing

2
推荐指数
1
解决办法
422
查看次数

标签 统计

c# ×1

json ×1

sql ×1

sql-server ×1

t-sql ×1

unit-testing ×1