static void Main(string[] args) { using (var app = new Conpanna()) { app.Get("/hello", (req, res) => res.Send("Hello World!")); app.Listen("localhost", 8080, () => Console.WriteLine("Listening on http://localhost:8080")); Console.ReadLine(); } }
public void CheckThatStartsFineWithoutCallback() { var address = "localhost"; var port = 8080; // Pass our container with mock HTTP service var app = new Conpanna(_container); app.Listen(address, port); app.Close(); }
public void IsListeningSetByStartAndClose() { var app = new Conpanna(_container); Assert.False(app.IsListening); app.Listen("localhost", 1000); Assert.True(app.IsListening); app.Close(); Assert.False(app.IsListening); }
public void CheckThatCallbackFires() { var address = "localhost"; var port = 8080; // Pass our container with mock HTTP service var app = new Conpanna(_container); bool called = false; app.Listen(address, port, () => { called = true; return; }); // Check if callback was called Assert.True(called); app.Close(); }