Exemplo n.º 1
0
 public void ThrowsExceptionWhenStopping()
 {
     using (var server = new RestServer())
     {
         server.SetIsStopping(true);
         Should.Throw <UnableToStartHostException>(() => server.Start());
     }
 }
Exemplo n.º 2
0
            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);
                }
            }