public void ParsesPortAndProtocol(string name, int expectedPort, string expectedProtocol) { var result = PortAndProtocol.Parse(name).OrDefault(); Assert.Equal(expectedPort, result.Port); Assert.Equal(expectedProtocol, result.Protocol); }
public void DefaultProtocolIsTCP() { var result = PortAndProtocol.Parse("3434").OrDefault(); Assert.Equal(3434, result.Port); Assert.Equal("TCP", result.Protocol); }
public void UnableToParseTooManyParts() { var result = PortAndProtocol.Parse("10/tcp/udp"); Assert.Equal(Option.None <PortAndProtocol>(), result); }
public void UnableToParseInvalidPort() { var result = PortAndProtocol.Parse("1a23/TCP"); Assert.Equal(Option.None <PortAndProtocol>(), result); }
public void UnableToParseUnsupportedProtocol() { var result = PortAndProtocol.Parse("123/HTTP"); Assert.Equal(Option.None <PortAndProtocol>(), result); }
public void UnableToParseEmptyString(string name) { var result = PortAndProtocol.Parse(name); Assert.Equal(Option.None <PortAndProtocol>(), result); }