public void BaseHttpServerStart_Test() { IBaseHttpServer server = new FakeHttpServer(); server.StartServer(); using (WebClient client = new WebClient()) { Assert.Equal(string.Empty, client.DownloadString("http://localhost:25566")); } }
public void BaseHttpServerStop_Test() { IBaseHttpServer server = new FakeHttpServer(); bool unableToDownload = false; server.StartServer(); server.StopServer(); using (WebClient client = new WebClient()) { try { Assert.Equal(string.Empty, client.DownloadString("http://localhost:25566")); } catch (WebException) { unableToDownload = true; } } Assert.True(unableToDownload); }