예제 #1
0
 public void IsFalseNullable_ExpressionIsNull_ShouldThrowArgumentNullException()
 {
     Assert.ThrowsException <ArgumentNullException>(
         () =>
     {
         Asserter.IsFalse(default(Expression <Func <bool?> >));
     });
 }
 public void IsFalse_ExpressionIsNull_ShouldThrowArgumentNullException()
 {
     Assert.ThrowsException <ArgumentNullException>(
         () =>
     {
         Asserter.IsFalse(null);
     });
 }
예제 #3
0
        public void IsFalseNullable_ConditionIsTrueBooleanMethodResult_ShouldThrowAssertFailedException()
        {
            var o = new TestObject();

            Assert.ThrowsException <AssertFailedException>(
                () =>
            {
                Asserter.IsFalse(() => o.NullableBooleanMethodTest(true));
            });
        }
예제 #4
0
        public void IsFalseNullable_ConditionIsFalseBooleanMethodResult_ShouldNotThrowAssertFailedException()
        {
            var o = new TestObject();

            ExceptionAsserter.DoesNotThrowException <AssertFailedException>(
                () =>
            {
                Asserter.IsFalse(() => o.NullableBooleanMethodTest(false));
            });
        }
예제 #5
0
        public void IsFalseNullable_ConditionIsTrueBooleanProperty_ShouldThrowAssertFailedException()
        {
            var o = new TestObject {
                NullableBooleanPropertyTest = true
            };

            Assert.ThrowsException <AssertFailedException>(
                () =>
            {
                Asserter.IsFalse(() => o.NullableBooleanPropertyTest);
            });
        }
예제 #6
0
        public void IsFalseNullable_ConditionIsFalseBooleanProperty_ShouldNotThrowAssertFailedException()
        {
            var o = new TestObject {
                NullableBooleanPropertyTest = false
            };

            ExceptionAsserter.DoesNotThrowException <AssertFailedException>(
                () =>
            {
                Asserter.IsFalse(() => o.NullableBooleanPropertyTest);
            });
        }
        public void IsFalse_ConditionIsSimpleAndBinaryExpressionThatReturnsFalse_ShouldNotThrowAssertFailedException()
        {
            var o = new TestObject {
                BooleanPropertyTest = true
            };

            ExceptionAsserter.DoesNotThrowException <AssertFailedException>(
                () =>
            {
                Asserter.IsFalse(() => !(o.BooleanPropertyTest && o.BooleanMethodTest(true)));
            });
        }
        public void IsFalse_ConditionIsSimpleAndBinaryExpressionThatReturnsTrue_ShouldThrowAssertFailedException()
        {
            var o = new TestObject {
                BooleanPropertyTest = false
            };

            Assert.ThrowsException <AssertFailedException>(
                () =>
            {
                // (!(false && true)) == true
                Asserter.IsFalse(() => !(o.BooleanPropertyTest && o.BooleanMethodTest(true)));
            });
        }
        IsFalse_ConditionIsComplexAndOrBinaryExpressionThatReturnsTrueForLeftPartButFalseForRightPart_ShouldNotThrowAssertFailedException()
        {
            var o = new TestObject {
                BooleanPropertyTest = true
            };
            var p = new TestObject {
                BooleanPropertyTest = false
            };

            ExceptionAsserter.DoesNotThrowException <AssertFailedException>(
                () =>
            {
                // (!(true && true) || false ) == false
                Asserter.IsFalse(() => !(o.BooleanPropertyTest && o.BooleanMethodTest(true)) || p.BooleanPropertyTest);
            });
        }
        IsFalse_ConditionIsComplexAndOrBinaryExpressionThatReturnsTrueForAllParts_ShouldThrowAssertFailedException()
        {
            var o = new TestObject {
                BooleanPropertyTest = true
            };
            var p = new TestObject {
                BooleanPropertyTest = true
            };

            Assert.ThrowsException <AssertFailedException>(
                () =>
            {
                // (!(true && false) || true) == true
                Asserter.IsFalse(() => !(o.BooleanPropertyTest && o.BooleanMethodTest(false)) || p.BooleanPropertyTest);
            });
        }