public static void Ctor_String_Exception()
        {
            string message        = "bad format";
            var    innerException = new Exception("Inner exception");
            var    exception      = new FormatException(message, innerException);

            ExceptionHelpers.ValidateExceptionProperties(exception, hResult: COR_E_FORMAT, innerException: innerException, message: message);
        }
Example #2
0
        public static void Ctor_String_Exception()
        {
            string message        = "timeout";
            var    innerException = new Exception("Inner exception");
            var    exception      = new TimeoutException(message, innerException);

            ExceptionHelpers.ValidateExceptionProperties(exception, hResult: COR_E_TIMEOUT, innerException: innerException, message: message);
        }
        public static void Ctor_String_Exception()
        {
            string message        = "overflow";
            var    innerException = new Exception("Inner exception");
            var    exception      = new OverflowException(message, innerException);

            ExceptionHelpers.ValidateExceptionProperties(exception, hResult: COR_E_OVERFLOW, innerException: innerException, message: message);
        }
Example #4
0
        public static void Ctor_String()
        {
            string message   = "type failed to load";
            var    exception = new TypeLoadException(message);

            ExceptionHelpers.ValidateExceptionProperties(exception, hResult: COR_E_TYPELOAD, message: message);
            Assert.Equal("", exception.TypeName);
        }
        public static void Ctor_String_Exception()
        {
            string message        = "divide by zero";
            var    innerException = new Exception("Inner exception");
            var    exception      = new DivideByZeroException(message, innerException);

            ExceptionHelpers.ValidateExceptionProperties(exception, hResult: COR_E_DIVIDEBYZERO, innerException: innerException, message: message);
        }
Example #6
0
        public static void Ctor_String_Exception()
        {
            string message        = "invalid operation";
            var    innerException = new Exception("Inner exception");
            var    exception      = new InvalidOperationException(message, innerException);

            ExceptionHelpers.ValidateExceptionProperties(exception, hResult: COR_E_INVALIDOPERATION, innerException: innerException, message: message);
        }
        public static void Ctor_String_Exception()
        {
            string message        = "out of range";
            var    innerException = new Exception("Inner exception");
            var    exception      = new IndexOutOfRangeException(message, innerException);

            ExceptionHelpers.ValidateExceptionProperties(exception, hResult: COR_E_INDEXOUTOFRANGE, innerException: innerException, message: message);
        }
Example #8
0
        public static void Ctor_String_Exception()
        {
            string message        = "object disposed";
            var    innerException = new Exception("Inner exception");
            var    exception      = new ObjectDisposedException(message, innerException);

            ExceptionHelpers.ValidateExceptionProperties(exception, hResult: COR_E_OBJECTDISPOSED, innerException: innerException, message: message);
            Assert.Equal("", exception.ObjectName);
        }
Example #9
0
        public static void Ctor_String_Exception()
        {
            string message        = "the argument is wrong";
            var    innerException = new Exception("Inner exception");
            var    exception      = new ArgumentException(message, innerException);

            ExceptionHelpers.ValidateExceptionProperties(exception, hResult: COR_E_ARGUMENT, innerException: innerException, message: message);
            Assert.Null(exception.ParamName);
        }
Example #10
0
        public static void Ctor_String()
        {
            string argumentName = "theArgument";
            var    exception    = new ArgumentOutOfRangeException(argumentName);

            ExceptionHelpers.ValidateExceptionProperties(exception, hResult: COR_E_ARGUMENTOUTOFRANGE, validateMessage: false);
            Assert.Equal(argumentName, exception.ParamName);
            Assert.Null(exception.ActualValue);
        }
        public static void Ctor_String_Exception()
        {
            string message        = "this is not the file you're looking for";
            var    innerException = new Exception("Inner exception");
            var    exception      = new BadImageFormatException(message, innerException);

            ExceptionHelpers.ValidateExceptionProperties(exception, hResult: COR_E_BADIMAGEFORMAT, innerException: innerException, message: message);
            Assert.Null(exception.FileName);
        }
        public static void Ctor_String_String()
        {
            string message   = "this is not the file you're looking for";
            string fileName  = "file.txt";
            var    exception = new BadImageFormatException(message, fileName);

            ExceptionHelpers.ValidateExceptionProperties(exception, hResult: COR_E_BADIMAGEFORMAT, message: message);
            Assert.Equal(fileName, exception.FileName);
        }
        public static void Ctor_String_Exception()
        {
            string message        = "the argument is null";
            var    innerException = new Exception("Inner exception");
            var    exception      = new ArgumentNullException(message, innerException);

            ExceptionHelpers.ValidateExceptionProperties(exception, hResult: E_POINTER, innerException: innerException, message: message);
            Assert.Null(exception.ParamName);
        }
        public static void Ctor_String_Type_String()
        {
            string message   = "security problem";
            var    exception = new SecurityException(message, typeof(SecurityExceptionTests), "permission state");

            ExceptionHelpers.ValidateExceptionProperties(exception, hResult: COR_E_SECURITY, message: message);
            Assert.Equal(typeof(SecurityExceptionTests), exception.PermissionType);
            Assert.Equal("permission state", exception.PermissionState);
        }
Example #15
0
        public static void Ctor_String_Exception()
        {
            string message        = "the argument is out of range";
            var    innerException = new Exception("Inner exception");
            var    exception      = new ArgumentOutOfRangeException(message, innerException);

            ExceptionHelpers.ValidateExceptionProperties(exception, hResult: COR_E_ARGUMENTOUTOFRANGE, innerException: innerException, message: message);
            Assert.Null(exception.ParamName);
            Assert.Null(exception.ActualValue);
        }
Example #16
0
        public static void Ctor_String_String()
        {
            string message    = "object disposed";
            string objectName = "theObject";
            var    exception  = new ObjectDisposedException(objectName, message);

            ExceptionHelpers.ValidateExceptionProperties(exception, hResult: COR_E_OBJECTDISPOSED, validateMessage: false);
            Assert.Equal(objectName, exception.ObjectName);
            Assert.Contains(message, exception.Message);
            Assert.Contains(objectName, exception.Message);
        }
Example #17
0
        public static void Ctor_String_String()
        {
            string message      = "the argument is wrong";
            string argumentName = "theArgument";
            var    exception    = new ArgumentException(message, argumentName);

            ExceptionHelpers.ValidateExceptionProperties(exception, hResult: COR_E_ARGUMENT, validateMessage: false);
            Assert.Equal(argumentName, exception.ParamName);
            Assert.Contains(message, exception.Message);
            Assert.Contains(argumentName, exception.Message);
        }
        public static void Ctor_String_String()
        {
            string message      = "the argument is null";
            string argumentName = "theNullArgument";
            var    exception    = new ArgumentNullException(argumentName, message);

            ExceptionHelpers.ValidateExceptionProperties(exception, hResult: E_POINTER, validateMessage: false);
            Assert.Equal(argumentName, exception.ParamName);
            Assert.Contains(message, exception.Message);
            Assert.Contains(argumentName, exception.Message);
        }
Example #19
0
        public static void Ctor_String_Object_String()
        {
            string message       = "the argument is out of range";
            string argumentName  = "theArgument";
            int    argumentValue = Int32.MaxValue;
            var    exception     = new ArgumentOutOfRangeException(argumentName, argumentValue, message);

            ExceptionHelpers.ValidateExceptionProperties(exception, hResult: COR_E_ARGUMENTOUTOFRANGE, validateMessage: false);
            Assert.Equal(argumentName, exception.ParamName);
            Assert.Contains(message, exception.Message);
            Assert.Contains(argumentName, exception.Message);
            Assert.Contains(argumentValue.ToString(), exception.Message);
        }
        public static void Ctor_Empty()
        {
            var exception = new InvalidProgramException();

            ExceptionHelpers.ValidateExceptionProperties(exception, hResult: COR_E_INVALIDPROGRAM, validateMessage: false);
        }
        public static void Ctor_Empty()
        {
            var exception = new OutOfMemoryException();

            ExceptionHelpers.ValidateExceptionProperties(exception, hResult: COR_E_OUTOFMEMORY, validateMessage: false);
        }
        public static void Ctor_Empty()
        {
            var exception = new FormatException();

            ExceptionHelpers.ValidateExceptionProperties(exception, hResult: COR_E_FORMAT, validateMessage: false);
        }
        public static void Ctor_Empty()
        {
            var exception = new OverflowException();

            ExceptionHelpers.ValidateExceptionProperties(exception, hResult: COR_E_OVERFLOW, validateMessage: false);
        }
Example #24
0
        public static void Ctor_Empty()
        {
            var exception = new Exception();

            ExceptionHelpers.ValidateExceptionProperties(exception, hResult: COR_E_EXCEPTION, validateMessage: false);
        }
        public static void Ctor_Empty()
        {
            var exception = new TimeoutException();

            ExceptionHelpers.ValidateExceptionProperties(exception, hResult: COR_E_TIMEOUT, validateMessage: false);
        }
Example #26
0
        public static void Ctor_Empty()
        {
            var exception = new ArithmeticException();

            ExceptionHelpers.ValidateExceptionProperties(exception, hResult: COR_E_ARITHMETIC, validateMessage: false);
        }
Example #27
0
        public static void Ctor_Empty()
        {
            var exception = new NotImplementedException();

            ExceptionHelpers.ValidateExceptionProperties(exception, hResult: E_NOTIMPL, validateMessage: false);
        }
        public static void Ctor_Empty()
        {
            var exception = new ArrayTypeMismatchException();

            ExceptionHelpers.ValidateExceptionProperties(exception, hResult: COR_E_ARRAYTYPEMISMATCH, validateMessage: false);
        }
        public static void Ctor_Empty()
        {
            var exception = new PlatformNotSupportedException();

            ExceptionHelpers.ValidateExceptionProperties(exception, hResult: COR_E_PLATFORMNOTSUPPORTED, validateMessage: false);
        }
        public static void Ctor_Empty()
        {
            var exception = new MemberAccessException();

            ExceptionHelpers.ValidateExceptionProperties(exception, hResult: COR_E_MEMBERACCESS, validateMessage: false);
        }