示例#1
0
 static void Main(string[] args)
 {
     var app = new SelfHostedWebApp(59911);
     app.Start();
     Console.WriteLine("Hosting on " + app.HostAddress);
     Console.WriteLine("Hit enter to stop the server");
     Console.ReadLine();
     app.Stop();
 }
 public void CorrectQueryShowsCorrectQueryMessage()
 {
     using (var app = new SelfHostedWebApp(Port))
     {
         app.Start();
         using (var browser = AppBrowser.Open(app.HostAddress))
         {
             browser.SubmitQuery("SELECT model FROM cars");
             Assert.Equal("", browser.ReadError());
             Assert.Equal(true, browser.IsCorrectAnswer());
         }
     }
 }
 public void EnteringIncorrectQueryShowsError()
 {
     using (var app = new SelfHostedWebApp(Port))
     {
         app.Start();
         using (var browser = AppBrowser.Open(app.HostAddress))
         {
             browser.SubmitQuery("Kablam!");
             Assert.Equal(
                 "There was an error in your SQL query: Incorrect syntax near '!'.",
                 browser.ReadError()
             );
             Assert.Equal(false, browser.IsCorrectAnswer());
         }
     }
 }