Coder Social home page Coder Social logo

universsky / httpmock Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hibri/httpmock

0.0 2.0 0.0 7.87 MB

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

Home Page: http://www.hibri.net/2011/06/11/mocking-http-servers/

License: Other

httpmock's Introduction

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

Similar to a mocking/stubbing library but used to mock/stub 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));
	}

httpmock's People

Contributors

hibri avatar gregsochanik avatar knocte avatar ntcoding avatar

Watchers

James Cloos avatar Jack Chen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.