Skip to content

stevenao/HttpMock

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

[![Build status] (https://ci.appveyor.com/api/projects/status/github/stevenao/httpMock)] (https://ci.appveyor.com/project/stevenao/httpmock)

A .Net library to create HTTP servers, which returns canned responses at run time.

Like a stubbing library, but with actual HTTP Responses.

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));
}

I have removed dependecy on NUnit in the HttpMock project. The hosting application will have to implement the IHttpMockAssert interface.

About

A library for creating Http servers on the fly in tests and stubbing responses

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 99.8%
  • PowerShell 0.2%