public void WhenContainerNotActive_Throws() { Container.Stop(false); Action action = () => Container.ReservePort(3000); Assert.Throws <InvalidOperationException>(action); }
public void ReturnsReservedPort() { TcpPortManager.ReserveLocalPort(3000, _containerUsername).Returns(5000); var port = Container.ReservePort(3000); Assert.Equal(5000, port); }
public void ReleasesPorts() { TcpPortManager.ReserveLocalPort(Arg.Any <int>(), Arg.Any <string>()) .Returns(c => c.Arg <int>()); Container.ReservePort(100); Container.ReservePort(101); Container.Destroy(); TcpPortManager.Received(1).ReleaseLocalPort(100, User.UserName); TcpPortManager.Received(1).ReleaseLocalPort(101, User.UserName); }
public void ReturnsListOfReservedPorts() { TcpPortManager.ReserveLocalPort(1000, Arg.Any <string>()).Returns(1000); TcpPortManager.ReserveLocalPort(1001, Arg.Any <string>()).Returns(1001); Container.ReservePort(1000); Container.ReservePort(1001); var info = Container.GetInfo(); Assert.Collection(info.ReservedPorts, x => Assert.Equal(1000, x), x => Assert.Equal(1001, x) ); }
public void ReservesPortForContainerUser() { Container.ReservePort(3000); TcpPortManager.Received(1).ReserveLocalPort(3000, _containerUsername); }