在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:hibri/HttpMock开源软件地址:https://github.com/hibri/HttpMock开源编程语言:C# 99.8%开源软件介绍:HttpMockHttpMock enables you to mock the behaviour of HTTP services, that your application depends on, during testing. It's particularly useful for Integration and Acceptance testing. HttpMock returns canned responses at run time. Usage.First, in the application you are testing, change the url of the HTTP service you want to mock, with the url for HttpMock. Tell HttpMock to listen on the port you've provided. This is always localhost For example:
Setup the stub that will return the canned response.
There are three essential parts to setting up a stub.
Eample usage: [Test]
public void SUT_should_return_stubbed_response()
{
_stubHttp = HttpMockRepository.At("http://localhost:9191");
const string expected = "<xml><response>Hello World</response></xml>";
_stubHttp.Stub(x => x.Get("/endpoint"))
.Return(expected)
.OK();
string result = new WebClient().DownloadString("http://localhost:9191/endpoint");
Console.WriteLine("RESPONSE: {0}", result);
Assert.That(result, Is.EqualTo(expected));
} Reporting Issues.When reporting issues, please provide a failing test. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论