public void StoppingStopsListener() { // Arrange var listener = new Mock <IHttpListener>(); listener.Setup(c => c.Stop()).Verifiable(); var proxy = new MediaProxyServer(null, listener.Object); // Act proxy.Stop(); // Assert listener.Verify(c => c.Stop(), Times.Once()); }
public void StartingAddsPrefix() { // Arrange var listener = new Mock <IHttpListener>(); listener.Setup(c => c.AddPrefix(It.IsAny <string>())).Verifiable(); var proxy = new MediaProxyServer(null, listener.Object); // Act try { proxy.Start(null); } finally { proxy.Stop(); } // Assert listener.Verify(c => c.AddPrefix(It.IsAny <string>()), Times.Once()); }