Example #1
0
        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);
        }
Example #2
0
        public void DefaultProtocolIsTCP()
        {
            var result = PortAndProtocol.Parse("3434").OrDefault();

            Assert.Equal(3434, result.Port);
            Assert.Equal("TCP", result.Protocol);
        }
Example #3
0
        public void UnableToParseTooManyParts()
        {
            var result = PortAndProtocol.Parse("10/tcp/udp");

            Assert.Equal(Option.None <PortAndProtocol>(), result);
        }
Example #4
0
        public void UnableToParseInvalidPort()
        {
            var result = PortAndProtocol.Parse("1a23/TCP");

            Assert.Equal(Option.None <PortAndProtocol>(), result);
        }
Example #5
0
        public void UnableToParseUnsupportedProtocol()
        {
            var result = PortAndProtocol.Parse("123/HTTP");

            Assert.Equal(Option.None <PortAndProtocol>(), result);
        }
Example #6
0
        public void UnableToParseEmptyString(string name)
        {
            var result = PortAndProtocol.Parse(name);

            Assert.Equal(Option.None <PortAndProtocol>(), result);
        }