示例#1
0
        public void ReturnTrueGivenExceptionIsOfType()
        {
            // Arrange
            var exception = new NullReferenceException();

            // Act
            var isOfType = exception.IsOrContainsExceptionOfType <NullReferenceException>();

            // Assert
            Assert.IsTrue(isOfType);
        }
示例#2
0
        public void ReturnFalseGivenExceptionIsNotOfType()
        {
            // Arrange
            var exception = new NullReferenceException();

            // Act
            var isOfType = exception.IsOrContainsExceptionOfType <NotImplementedException>();

            // Assert
            Assert.IsFalse(isOfType);
        }
示例#3
0
        public void ReturnTrueGivenExceptionContainsType()
        {
            // Arrange
            var innerException = new NotImplementedException();
            var exception      = new NullReferenceException("Test", innerException);

            // Act
            var isOfType = exception.IsOrContainsExceptionOfType <NotImplementedException>();

            // Assert
            Assert.IsTrue(isOfType);
        }
示例#4
0
        public void ReturnFalseGivenExceptionDoesNotContainType()
        {
            // Arrange
            var innerException = new NotImplementedException();
            var exception      = new NullReferenceException("Test", innerException);

            // Act
            var isOfType = exception.IsOrContainsExceptionOfType <FileNotFoundException>();

            // Assert
            Assert.IsFalse(isOfType);
        }