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