public void NotThrowIfThePredicateReturnsFalseForADoubleType()
        {
            var    ex       = new TestException();
            double maxValue = Convert.ToDouble(Single.MaxValue);

            ex.ThrowIf <double>(o => false, maxValue.GetRandom());
        }
        public void NotThrowIfThePredicateResultsInAFalseValueForAnObjType()
        {
            object testVal = new object();
            var    ex      = new TestException();
            Func <object, bool> predicate = i => i == null;

            ex.ThrowIf(predicate, testVal);
        }
        public void ThrowTheExceptionIfThePredicateResultsInATrueValueForAnObjType()
        {
            object testVal = new object();
            var    ex      = new TestException();
            Func <object, bool> predicate = i => i != null;

            Assert.Throws <TestException>(() => ex.ThrowIf(predicate, testVal));
        }
        public void NotThrowIfThePredicateResultsInAFalseValueForAnIntType()
        {
            int switchVal = 255.GetRandom(10);
            int testVal   = switchVal - 99.GetRandom(1);

            var ex = new TestException();
            Func <int, bool> predicate = i => i > switchVal;

            ex.ThrowIf(predicate, testVal);
        }
        public void ThrowTheExceptionIfThePredicateResultsInATrueValueForAnIntType()
        {
            int switchVal = 255.GetRandom(10);
            int testVal   = switchVal + 99.GetRandom(1);

            var ex = new TestException();
            Func <int, bool> predicate = i => i > switchVal;

            Assert.Throws <TestException>(() => ex.ThrowIf(predicate, testVal));
        }
        public void NotThrowIfThePredicateResultsInAFalseValueForADoubleType()
        {
            double switchVal = (5225.0).GetRandom(10.0);
            double testVal   = switchVal + (99.9).GetRandom(1.0);

            var ex = new TestException();
            Func <double, bool> predicate = i => i < switchVal;

            ex.ThrowIf(predicate, testVal);
        }
        public void ThrowTheExceptionIfThePredicateResultsInATrueValueForADoubleType()
        {
            double switchVal = (5225.0).GetRandom(10.0);
            double testVal   = switchVal + (99.9).GetRandom(1.0);

            var ex = new TestException();
            Func <double, bool> predicate = i => i > switchVal;

            Assert.Throws <TestException>(() => ex.ThrowIf(predicate, testVal));
        }
        public void NotThrowIfThePredicateReturnsFalseForAnIntType()
        {
            var ex = new TestException();

            ex.ThrowIf <int>(o => false, Int32.MaxValue.GetRandom());
        }
        public void ThrowAnExceptionIfThePredicateReturnsTrueForAnIntType()
        {
            var ex = new TestException();

            Assert.Throws <TestException>(() => ex.ThrowIf <int>(o => true, Int32.MaxValue.GetRandom()));
        }
        public void NotThrowIfThePredicateReturnsFalseForAnObjType()
        {
            var ex = new TestException();

            ex.ThrowIf <object>(o => false, null);
        }
        public void ThrowAnExceptionIfThePredicateReturnsTrueForAnObjType()
        {
            var ex = new TestException();

            Assert.Throws <TestException>(() => ex.ThrowIf <object>(o => true, null));
        }
        public void NotThrowAnExceptionIfTheExceptionIsNullButThePredicateFalse()
        {
            TestException ex = null;

            ex.ThrowIf <object>(o => false, null);
        }
        public void ThrowAnArgumentNullExceptionIfTheExceptionIsNullAndThePredicateTrue()
        {
            TestException ex = null;

            Assert.Throws <ArgumentNullException>(() => ex.ThrowIf <object>(o => true, null));
        }