示例#1
0
 public void TryPingExistingHostExceptionOnError()
 {
     try
     {
         TcpPing.Send(CorrectHost, Port, ThrowOnError).Should().BeTrue();
     }
     catch (Exception ex)
     {
         var socketException = ex as SocketException;
         socketException.Should().NotBeNull();
         socketException?.ErrorCode.Should().Be(11001);
     }
 }
示例#2
0
        public void TryPingWrongHostExceptionOnError()
        {
            Action action = () => TcpPing.Send(WrongDomain, Port, ThrowOnError);

            action.Should().Throw <SocketException>().And.ErrorCode.Should().Be(11001);
        }
示例#3
0
 public void TryPingWrongHostFalseOnError()
 {
     TcpPing.Send(WrongDomain).Should().BeFalse();
 }
示例#4
0
        public void TryPingExistingHostFalseOnError()
        {
            Action action = () => TcpPing.Send(CorrectHost);

            action.Should().NotThrow();
        }