예제 #1
0
        public void PortFoundButUnassigned()
        {
            //Prepare
            const Int32 PORT = 4;
            const System.Net.Sockets.ProtocolType PROTOCOL = System.Net.Sockets.ProtocolType.Udp;

            //Act
            var result = NetworkHelpers.GetKnownPort(PORT, PROTOCOL);

            //Assert
            Assert.IsNull(result);
        }
예제 #2
0
        public void WrongProtocol()
        {
            //Prepare
            const Int32 PORT = 111;
            const System.Net.Sockets.ProtocolType PROTOCOL = System.Net.Sockets.ProtocolType.Icmp;

            //Act
            var result = NetworkHelpers.GetKnownPort(PORT, PROTOCOL);

            //Assert
            Assert.Fail();
        }
예제 #3
0
        public void PortFound()
        {
            //Prepare
            const Int32 PORT = 1433;
            const System.Net.Sockets.ProtocolType PROTOCOL = System.Net.Sockets.ProtocolType.Tcp;

            //Act
            var result = NetworkHelpers.GetKnownPort(PORT, PROTOCOL);

            //Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(PORT, result.Port);
            Assert.AreEqual(PROTOCOL, result.Protocol);
        }