AreEnumerablesEqualComparer_ExpectedAndActualHaveSameObjectsInSameOrder_ShouldNotThrowAssertFailedExceptionIfEqualsOverride()
        {
            var comparer =
                new GenericComparer <EqualityTestObject, EqualityTestObject>(
                    (expected, actual) => expected.Equals(actual));

            var expected = new List <EqualityTestObject>
            {
                new EqualityTestObject(), new EqualityTestObject {
                    BooleanPropertyTest = true
                }
            };
            var actual = new List <EqualityTestObject>
            {
                new EqualityTestObject(), new EqualityTestObject {
                    BooleanPropertyTest = true
                }
            };

            ExceptionAsserter.DoesNotThrowException <AssertFailedException>(
                () =>
            {
                CollectionAsserter.AreEnumerablesEqual <EqualityTestObject>(expected, actual, comparer);
            });
        }
Beispiel #2
0
        public void IsNull_ConditionIsNull_ShouldNotThrowAssertFailedException()
        {
            var o = default(TestObject);

            ExceptionAsserter.DoesNotThrowException <AssertFailedException>(
                () =>
            {
                Asserter.IsNull(() => o);
            });
        }
Beispiel #3
0
        public void IsFalseNullable_ConditionIsFalseBooleanMethodResult_ShouldNotThrowAssertFailedException()
        {
            var o = new TestObject();

            ExceptionAsserter.DoesNotThrowException <AssertFailedException>(
                () =>
            {
                Asserter.IsFalse(() => o.NullableBooleanMethodTest(false));
            });
        }
Beispiel #4
0
 public void AreEnumerablesEqual_ExpectedAndActualAreNull_ShouldNotThrowAssertFailedException()
 {
     ExceptionAsserter.DoesNotThrowException <AssertFailedException>(
         () =>
     {
         CollectionAsserter.AreEnumerablesEqual <NoEqualityTestObject>(
             default(IEnumerable <NoEqualityTestObject>),
             default(IEnumerable <NoEqualityTestObject>));
     });
 }
        public void IsTrue_ConditionIsTrueBooleanMethodResult_ShouldNotThrowAssertFailedException()
        {
            var o = new TestObject();

            ExceptionAsserter.DoesNotThrowException <AssertFailedException>(
                () =>
            {
                Asserter.IsTrue(() => o.BooleanMethodTest(true));
            });
        }
        public void IsTrue_ConditionIsTrueBooleanProperty_ShouldNotThrowAssertFailedException()
        {
            var o = new TestObject {
                BooleanPropertyTest = true
            };

            ExceptionAsserter.DoesNotThrowException <AssertFailedException>(
                () =>
            {
                Asserter.IsTrue(() => o.BooleanPropertyTest);
            });
        }
Beispiel #7
0
        public void IsFalseNullable_ConditionIsFalseBooleanProperty_ShouldNotThrowAssertFailedException()
        {
            var o = new TestObject {
                NullableBooleanPropertyTest = false
            };

            ExceptionAsserter.DoesNotThrowException <AssertFailedException>(
                () =>
            {
                Asserter.IsFalse(() => o.NullableBooleanPropertyTest);
            });
        }
        public void IsInRangeUShort_ConditionIsInRange_ShouldNotThrowAssertFailedException()
        {
            ushort condition = 10;
            ushort minimum   = 5;
            ushort maximum   = 15;

            ExceptionAsserter.DoesNotThrowException <AssertFailedException>(
                () =>
            {
                Asserter.IsInRange(condition, minimum, maximum);
            });
        }
        public void IsInRangeULong_ConditionIsMaximum_ShouldNotThrowAssertFailedException()
        {
            ulong condition = 15;
            ulong minimum   = 5;
            ulong maximum   = condition;

            ExceptionAsserter.DoesNotThrowException <AssertFailedException>(
                () =>
            {
                Asserter.IsInRange(condition, minimum, maximum);
            });
        }
        public void IsInRangeSByte_ConditionIsInRange_ShouldNotThrowAssertFailedException()
        {
            sbyte condition = 10;
            sbyte minimum   = 5;
            sbyte maximum   = 15;

            ExceptionAsserter.DoesNotThrowException <AssertFailedException>(
                () =>
            {
                Asserter.IsInRange(condition, minimum, maximum);
            });
        }
        public void IsInRangeInt_ConditionIsMaximum_ShouldNotThrowAssertFailedException()
        {
            int condition = 15;
            int minimum   = 5;
            int maximum   = condition;

            ExceptionAsserter.DoesNotThrowException <AssertFailedException>(
                () =>
            {
                Asserter.IsInRange(condition, minimum, maximum);
            });
        }
Beispiel #12
0
        public void IsInRangeDouble_ConditionIsMinimum_ShouldNotThrowAssertFailedException()
        {
            double condition = 5;
            double minimum   = condition;
            double maximum   = 15;

            ExceptionAsserter.DoesNotThrowException <AssertFailedException>(
                () =>
            {
                Asserter.IsInRange(condition, minimum, maximum);
            });
        }
        public void IsInRangeDecimal_ConditionIsInRange_ShouldNotThrowAssertFailedException()
        {
            decimal condition = 10;
            decimal minimum   = 5;
            decimal maximum   = 15;

            ExceptionAsserter.DoesNotThrowException <AssertFailedException>(
                () =>
            {
                Asserter.IsInRange(condition, minimum, maximum);
            });
        }
        public void IsFalse_ConditionIsSimpleAndBinaryExpressionThatReturnsFalse_ShouldNotThrowAssertFailedException()
        {
            var o = new TestObject {
                BooleanPropertyTest = true
            };

            ExceptionAsserter.DoesNotThrowException <AssertFailedException>(
                () =>
            {
                Asserter.IsFalse(() => !(o.BooleanPropertyTest && o.BooleanMethodTest(true)));
            });
        }
Beispiel #15
0
        public void AreEnumerablesEqual_ExpectedAndActualAreSameReference_ShouldNotThrowAssertFailedException()
        {
            var expected = new List <NoEqualityTestObject> {
                new NoEqualityTestObject(), new NoEqualityTestObject {
                    BooleanPropertyTest = true
                }
            };
            List <NoEqualityTestObject> actual = expected;

            ExceptionAsserter.DoesNotThrowException <AssertFailedException>(
                () =>
            {
                CollectionAsserter.AreEnumerablesEqual <NoEqualityTestObject>(expected, actual);
            });
        }
        public void AreEnumerablesEqualComparer_ExpectedAndActualAreNull_ShouldNotThrowAssertFailedException()
        {
            var comparer =
                new GenericComparer <NoEqualityTestObject, NoEqualityTestObject>(
                    (expected, actual) => expected.Equals(actual));

            ExceptionAsserter.DoesNotThrowException <AssertFailedException>(
                () =>
            {
                CollectionAsserter.AreEnumerablesEqual <NoEqualityTestObject>(
                    default(IEnumerable <NoEqualityTestObject>),
                    default(IEnumerable <NoEqualityTestObject>),
                    comparer);
            });
        }
        IsTrue_ConditionIsComplexAndOrBinaryExpressionThatReturnsTrueForLeftPart_ShouldNotThrowAssertFailedException()
        {
            var o = new TestObject {
                BooleanPropertyTest = true
            };
            var p = new TestObject {
                BooleanPropertyTest = false
            };

            ExceptionAsserter.DoesNotThrowException <AssertFailedException>(
                () =>
            {
                Asserter.IsTrue(() => (o.BooleanPropertyTest && o.BooleanMethodTest(true)) || !p.BooleanPropertyTest);
            });
        }
        AreEnumerablesEquivalent_ExpectedAndActualHaveSameObjectsInSameOrder_ShouldNotThrowAssertFailedExceptionIfEqualsOverride()
        {
            var expected = new List <EqualityTestObject> {
                new EqualityTestObject(), new EqualityTestObject {
                    BooleanPropertyTest = true
                }
            };
            var actual = new List <EqualityTestObject> {
                new EqualityTestObject(), new EqualityTestObject {
                    BooleanPropertyTest = true
                }
            };

            ExceptionAsserter.DoesNotThrowException <AssertFailedException>(
                () =>
            {
                CollectionAsserter.AreEnumerablesEquivalent <EqualityTestObject>(expected, actual);
            });
        }
Beispiel #19
0
        AreEnumerablesEqual_ExpectedAndActualHaveSameReferenceObjectsInSameOrder_ShouldNotThrowAssertFailedException()
        {
            var o = new NoEqualityTestObject();
            var p = new NoEqualityTestObject {
                BooleanPropertyTest = true
            };

            var expected = new List <NoEqualityTestObject> {
                o, p
            };
            var actual = new List <NoEqualityTestObject> {
                o, p
            };

            ExceptionAsserter.DoesNotThrowException <AssertFailedException>(
                () =>
            {
                CollectionAsserter.AreEnumerablesEqual <NoEqualityTestObject>(expected, actual);
            });
        }