Exemplo n.º 1
0
        /// <summary>
        /// Gets the message associated with the given <see cref="SECURITY_STATUS"/>.
        /// </summary>
        /// <param name="status">The <see cref="SECURITY_STATUS"/> for the error.</param>
        /// <returns>The description of the error.</returns>
        private static string GetMessage(SECURITY_STATUS status)
        {
            string hexCode        = $"0x{(int)status:X8}";
            string namedCode      = Enum.GetName(typeof(SECURITY_STATUS), status);
            string statusAsString = namedCode != null
                ? $"{namedCode} ({hexCode})"
                : hexCode;
            string insert  = $"SECURITY_STATUS {GetSeverityString(status)}: {statusAsString}";
            string message = status.GetMessage();

            return(message != null
                ? $"{message} ({insert})"
                : insert);
        }
        /// <summary>
        /// Gets the message associated with the given <see cref="SECURITY_STATUS"/>.
        /// </summary>
        /// <param name="status">The <see cref="SECURITY_STATUS"/> for the error.</param>
        /// <returns>The description of the error.</returns>
        private static string GetMessage(SECURITY_STATUS status)
        {
            string hexCode = $"0x{(int)status:X8}";
            string namedCode = Enum.GetName(typeof(SECURITY_STATUS), status);
            string statusAsString = namedCode != null
                ? $"{namedCode} ({hexCode})"
                : hexCode;
            string insert = $"SECURITY_STATUS {GetSeverityString(status)}: {statusAsString}";
            string message = status.GetMessage();

            return message != null
                ? $"{message} ({insert})"
                : insert;
        }
Exemplo n.º 3
0
    public void GetMessage_SecurityStatus()
    {
        SECURITY_STATUS status = SECURITY_STATUS.NTE_BAD_DATA;

        Assert.Equal("Bad Data", status.GetMessage());
    }