Exemplo n.º 1
0
            public void ThrowsExceptionWhenExceptionOccursWhileStarting()
            {
                var listener = Substitute.For <IHttpListener>();

                listener.When(_ => _.Start()).Do(_ => { throw new Exception(); });

                using (var server = new RestServer(listener))
                {
                    Should.Throw <UnableToStartHostException>(() => server.Start());
                    server.GetIsStarting().ShouldBeFalse();
                }
            }