コード例 #1
0
        public void ErrorOccurredIsRaisedOnce()
        {
            Assert.AreEqual(1, ErrorOccurredRegister.Count, ErrorOccurredRegister.AsString());

            var errorOccurred = ErrorOccurredRegister[0];

            Assert.IsNotNull(errorOccurred);

            var exception = errorOccurred.Exception;

            Assert.IsNotNull(exception);
            Assert.AreEqual(typeof(SshConnectionException), exception.GetType());

            var connectionException = (SshConnectionException)exception;

            Assert.AreEqual(DisconnectReason.ConnectionLost, connectionException.DisconnectReason);

            var innerException = exception.InnerException;

            Assert.IsNotNull(innerException);
            Assert.AreEqual(typeof(SocketException), innerException.GetType());

            var socketException = (SocketException)innerException;

            Assert.AreSame(connectionException.Message, socketException.Message);
            Assert.AreEqual(SocketError.ConnectionReset, socketException.SocketErrorCode);
        }
コード例 #2
0
        public void ErrorOccurredIsRaisedOnce()
        {
            Assert.AreEqual(1, ErrorOccurredRegister.Count, ErrorOccurredRegister.AsString());

            var errorOccurred = ErrorOccurredRegister[0];

            Assert.IsNotNull(errorOccurred);

            var exception = errorOccurred.Exception;

            Assert.IsNotNull(exception);
            Assert.AreEqual(typeof(SshException), exception.GetType());

            var sshException = (SshException)exception;

            Assert.IsNull(sshException.InnerException);
            Assert.AreEqual("Message type 255 is not supported.", sshException.Message);
        }
        public void ErrorOccurredIsRaisedOnce()
        {
            Assert.AreEqual(1, ErrorOccurredRegister.Count, ErrorOccurredRegister.AsString());

            var errorOccurred = ErrorOccurredRegister[0];

            Assert.IsNotNull(errorOccurred);

            var exception = errorOccurred.Exception;

            Assert.IsNotNull(exception);
            Assert.AreEqual(typeof(SshConnectionException), exception.GetType());

            var connectionException = (SshConnectionException)exception;

            Assert.AreEqual(DisconnectReason.ConnectionLost, connectionException.DisconnectReason);
            Assert.IsNull(connectionException.InnerException);
            Assert.AreEqual("An established connection was aborted by the server.", connectionException.Message);
        }
コード例 #4
0
        public void ErrorOccurredIsRaisedOnce()
        {
            Assert.AreEqual(1, ErrorOccurredRegister.Count, ErrorOccurredRegister.AsString());

            var errorOccurred = ErrorOccurredRegister[0];

            Assert.IsNotNull(errorOccurred);

            var exception = errorOccurred.Exception;

            Assert.IsNotNull(exception);
            Assert.AreEqual(typeof(SshConnectionException), exception.GetType());

            var connectionException = (SshConnectionException)exception;

            Assert.AreEqual(DisconnectReason.ProtocolError, connectionException.DisconnectReason);
            Assert.IsNull(connectionException.InnerException);
            Assert.AreEqual("Bad packet length: 168101125.", connectionException.Message);
        }
コード例 #5
0
 public void ErrorOccurredIsNeverRaised()
 {
     Assert.AreEqual(0, ErrorOccurredRegister.Count, ErrorOccurredRegister.AsString());
 }
コード例 #6
0
 public void ErrorOccurredShouldNotBeRaised()
 {
     Assert.AreEqual(0, ErrorOccurredRegister.Count, ErrorOccurredRegister.AsString());
 }