public void Handle_when_request_not_matched_should_return_404() { // Assert var httpServer = new HttpServer(); var httpEngine = new HttpServerEngine(httpServer, 9000); httpEngine.Start(); // Act var result = Http.Get("http://localhost:9000/home/index").GetContent(); httpEngine.Stop(); // Assert result.Should().Be(string.Empty); }
public void Run() { // Arrange var server = new HttpServer(); server.When(request => request.Uri.Is("/home/index")) .Then(response => response.Text("foo")); var engine = new HttpServerEngine(server,9000).Start(); // Act var result = Http.Get("http://localhost:9000/home/index").GetContent(); engine.Stop(); // Assert Assert.That(result, Is.EqualTo("foo")); }
public void Handle_when_matched_request_should_reponse_setting_content() { // Assert var httpServer = new HttpServer(); httpServer.When(request => request.Uri.Is("/home/index")) .Then(response => response.Text("hello")); var httpEngine = new HttpServerEngine(httpServer, 9000); httpEngine.Start(); // Act var result = Http.Get("http://localhost:9000/home/index").GetContent(); httpEngine.Stop(); // Assert result.Should().Be("hello"); }
public void Run() { // Arrange var server = new HttpServer(); server.When(request => request.Uri.Is("/home/index")) .Then(response => response.Text("foo")); var engine = new HttpServerEngine(server, 9000).Start(); // Act var result = Http.Get("http://localhost:9000/home/index").GetContent(); engine.Stop(); // Assert Assert.That(result, Is.EqualTo("foo")); }