小编Cod*_*ker的帖子

使用NUnit3控制台运行测试

我正在尝试使用NUnit Console Runner通过命令行运行测试:https : //github.com/nunit/docs/wiki/Console-Runner

我已经在我的NuGet中安装了https://www.nuget.org/packages/NUnit.ConsoleRunner/ NUnit.ConsoleRunner

我在中打开了命令行位置\sanitized\bin\Debug\netcoreapp2.1。我使用https://github.com/nunit/docs/wiki/Console-Command-Line中NUNIT3-CONSOLE myTests.dll提到的命令运行测试

但是我得到了错误:

NUNIT3-CONSOLE:找不到命令

我应该使用什么命令?

注意:这是一个.netcore应用程序

c# nunit nuget nunit-3.0 .net-core

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

RestSharp JSON POST 请求遇到错误请求

我正在使用 RestSharp 发出包含 JSON 正文的 POST 请求。但我收到错误请求错误。

因为我已经[]""J​​SON 中决定使用 Newtonsoft.Json 。在使用它之前,我什至看不到正在形成的 JSON 请求。

我愿意尝试MS httpwebrequest作为替代方案。

restClient = new RestClient();

restRequest = new RestRequest(ApiUrl, Method.POST, DataFormat.Json);

var myObject = "{ \"target\" : \"[5,5]\", \"lastseen\" : \"1555459984\" }";

var json = JsonConvert.SerializeObject(myObject);
restRequest.AddParameter("application/json", ParameterType.RequestBody);

restRequest.AddJsonBody(json);
Run Code Online (Sandbox Code Playgroud)

请注意,我正在尝试将 JSON 卷曲转换为 C#。请看下面:

curl -H 'Content-Type: application/json' -X POST -d '{ "target" : [5, 5], "lastseen" : "1555459984", "previousTargets" : [ [1, 0], [2, 2], [2, 3] ] }' http://santized/santized/santized

c# post json restsharp web-api-testing

0
推荐指数
1
解决办法
9754
查看次数

标签 统计

c# ×2

.net-core ×1

json ×1

nuget ×1

nunit ×1

nunit-3.0 ×1

post ×1

restsharp ×1

web-api-testing ×1