public void ThrowsExceptionWhenStopping() { using (var server = new RestServer()) { server.SetIsStopping(true); Should.Throw <UnableToStartHostException>(() => server.Start()); } }
public void AbortsWhenAlreadyStopping() { var listener = Substitute.For <IHttpListener>(); listener.IsListening.Returns(true); using (var server = new RestServer(listener)) { server.SetIsStopping(true); server.Stop(); listener.DidNotReceive().Stop(); listener.IsListening.Returns(false); } }