Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MailKit.Security.SaslException"/> class.
        /// </summary>
        /// <remarks>
        /// Creates a new <see cref="SaslException"/>.
        /// </remarks>
        /// <param name="mechanism">The SASL mechanism.</param>
        /// <param name="code">The error code.</param>
        /// <param name="message">The error message.</param>
        /// <exception cref="System.ArgumentNullException">
        /// <paramref name="mechanism"/> is <c>null</c>.
        /// </exception>
        public SaslException(string mechanism, SaslErrorCode code, string message) : base(message)
        {
            if (mechanism == null)
            {
                throw new ArgumentNullException(nameof(mechanism));
            }

            Mechanism = mechanism;
            ErrorCode = code;
        }
Ejemplo n.º 2
0
		static void AssertSaslException (SaslMechanismScramSha1 sasl, string challenge, SaslErrorCode code)
		{
			var token = Encoding.ASCII.GetBytes (challenge);

			try {
				sasl.Challenge (Convert.ToBase64String (token));
			} catch (SaslException sex) {
				Assert.AreEqual (code, sex.ErrorCode, "ErrorCode");
				return;
			} catch (Exception ex) {
				Assert.Fail ("SaslException expected, but got: {0}", ex.GetType ().Name);
				return;
			}

			Assert.Fail ("SaslException expected.");
		}
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MailKit.Security.SaslException"/> class.
 /// </summary>
 /// <param name="mechanism">The SASL mechanism.</param>
 /// <param name="code">The error code.</param>
 /// <param name="message">The error message.</param>
 internal SaslException(string mechanism, SaslErrorCode code, string message) : base(message)
 {
     Mechanism = mechanism;
     ErrorCode = code;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MailKit.Security.SaslException"/> class.
 /// </summary>
 /// <param name="mechanism">The SASL mechanism.</param>
 /// <param name="code">The error code.</param>
 /// <param name="message">The error message.</param>
 internal SaslException(string mechanism, SaslErrorCode code, string message)
     : base(message)
 {
     Mechanism = mechanism;
     ErrorCode = code;
 }
Ejemplo n.º 5
0
		/// <summary>
		/// Initializes a new instance of the <see cref="MailKit.Security.SaslException"/> class.
		/// </summary>
		/// <remarks>
		/// Creates a new <see cref="SaslException"/>.
		/// </remarks>
		/// <param name="mechanism">The SASL mechanism.</param>
		/// <param name="code">The error code.</param>
		/// <param name="message">The error message.</param>
		/// <exception cref="System.ArgumentNullException">
		/// <paramref name="mechanism"/> is <c>null</c>.
		/// </exception>
		public SaslException (string mechanism, SaslErrorCode code, string message) : base (message)
		{
			if (mechanism == null)
				throw new ArgumentNullException (nameof (mechanism));

			Mechanism = mechanism;
			ErrorCode = code;
		}