声明条件,且AND必须匹配

时间:2019-11-21 02:50:54

标签: assert assertion

我的API响应如下:

{
    "created": "2019-11-21T02:30:48.890187Z",
    "OrderId": "8321112019103048",
    "items": [
        {
            "id": "1f55801f-e049-43d9-b31c-09f99d47c004",
            "itemId": "A",
            "Reports": [
                {
                    "activity": "COMPLETED",
                    "expirationDate": "2029-10-16T00:00:00",
                    "itemId": "1f55801f-e049-43d9-b31c-09f99d47c004",
                    "itemIdentifier": "B6699945634111c",
                    "location": "Phar A New",
                    "lotNumber": "LOT-ABC-1",
                    "quantity": 100,
                    "serialNumber": "SA975320574"
                }
            ],
            "quantity": 100
        },
        {
            "id": "320e02d4-52f1-43d8-b8e4-7ef4e10b093b",
            "itemId": "B",
            "Reports": [
                {
                    "activity": "COMPLETED",
                    "expirationDate": "2029-05-01T00:00:00",
                    "itemId": "320e02d4-52f1-43d8-b8e4-7ef4e10b093b",
                    "itemIdentifier": "B6699945634222d",
                    "location": "Phar D",
                    "lotNumber": "LOT-ABC-D",
                    "quantity": 300,
                    "serialNumber": "SA24325435999"
                }
            ],
            "quantity": 300
        },
        {
            "id": "7932fc39-41d5-4381-9ffb-751a2c1c710a",
            "itemId": "C",
            "Reports": [
                {
                    "activity": "STOCKOUT",
                    "expirationDate": "2029-10-16T00:00:00",
                    "itemId": "7932fc39-41d5-4381-9ffb-751a2c1c710a",
                    "itemIdentifier": "B6699945634222c",
                    "location": "Phar A New",
                    "lotNumber": "LOT-ABC-1",
                    "quantity": 0,
                    "serialNumber": "SA24325435534"
                },
                {
                    "activity": "COMPLETED",
                    "expirationDate": "2029-05-01T00:00:00",
                    "itemId": "7932fc39-41d5-4381-9ffb-751a2c1c710a",
                    "itemIdentifier": "B6699945634222c",
                    "location": "Phar A New",
                    "lotNumber": "LOT-ABC-1AA",
                    "quantity": 100,
                    "serialNumber": "SA24325435999"
                },
                {
                    "activity": "COMPLETED",
                    "expirationDate": "2029-05-01T00:00:00",
                    "itemId": "7932fc39-41d5-4381-9ffb-751a2c1c710a",
                    "itemIdentifier": "B6699945634888d",
                    "location": "Phar A New",
                    "lotNumber": "LOT-ABC-D",
                    "quantity": 60,
                    "serialNumber": "SA24325435888"
                },
                {
                    "activity": "COMPLETED",
                    "expirationDate": "2029-05-01T00:00:00",
                    "itemId": "7932fc39-41d5-4381-9ffb-751a2c1c710a",
                    "itemIdentifier": "B6699945634999d",
                    "location": "Phar A New",
                    "lotNumber": "LOT-ABC-D",
                    "quantity": 40,
                    "serialNumber": "SA24325435999"
                }
            ],
            "quantity": 200
        }
    ],
    "lastModified": "2019-11-21T02:31:33.9110279Z",
}

我想确保在“报告”中捕获的结果是正确的(AND条件),因为在不同的子报告中可能会打印相同的值。

断言 当itemId = C时,则报告[0]:itemIdentifier +位置+数量= B6699945634222c,Phar A New,0

当itemId = C时,则报告[1]:itemIdentifier +位置+数量= B6699945634222c,Phar A新,100 ......等等,都是Reports [2],[3]。

我不确定带有条件的断言的完整声明是什么。

0 个答案:

没有答案