Created
June 5, 2011 11:40
-
-
Save hibri/1008889 to your computer and use it in GitHub Desktop.
Http Mocking
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Test] | |
public void Foo() { | |
IHttpEndpoint httpEndpoint = new HttpEndpoint() | |
.At(new Uri("Http://localhost:8080/api")) | |
.WithNewContext(); | |
httpEndpoint | |
.Stub(x => x.Get("/")) | |
.Return("Index") | |
.OK(); | |
httpEndpoint | |
.Stub(x => x.Get("/status")) | |
.Return("Hello") | |
.OK(); | |
httpEndpoint | |
.Stub(x => x.Get("/echo")) | |
.Return("Echo") | |
.OK(); | |
WebClient wc = new WebClient(); | |
Console.WriteLine(wc.DownloadString("Http://localhost:8080/api/")); | |
Console.WriteLine(wc.DownloadString("Http://localhost:8080/api/status")); | |
Console.WriteLine(wc.DownloadString("Http://localhost:8080/api/echo")); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment