小编Sat*_*kla的帖子

如何模拟httpclient

我是 TDD 新手,能否请您使用 moq 编写测试用例以获取以下代码 -

public async Task<Model> GetAssetDeliveryRecordForId(string id)
{
    var response = await client.GetAsync($"api/getdata?id={id}");
    response.EnsureSuccessStatusCode();
    var result = await response.Content.ReadAsAsync<Model>();
    return result;
}
Run Code Online (Sandbox Code Playgroud)

提前致谢。

c# nunit moq .net-core

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

标签 统计

.net-core ×1

c# ×1

moq ×1

nunit ×1