Beispiel #1
0
        public void IfNotEqualNulls()
        {
            // ARRANGE
            object o1 = null;
            object o2 = null;

            // ACT
            Fail.IfNotEqual(o1, o2, "values differ and should be equal");
        }
Beispiel #2
0
        public void IfNotEqual()
        {
            // ACT
            var exception = Assert.Throws <DesignByContractViolationException>(
                () => Fail.IfNotEqual("s1", "s2", "values differ and should be equal")
                );

            // ASSERT
            Assert.That(exception.Message, Is.EqualTo("values differ and should be equal"));
        }
Beispiel #3
0
        public void IfNotEqualWithName(Pair obj)
        {
            // ACT
            var exception = Assert.Throws <DesignByContractViolationException>(
                () => Fail.IfNotEqual(obj.Value2, obj.Value1, nameof(obj))
                );

            // ASSERT
            Assert.That(exception.Message, Is.EqualTo("'obj' (" + obj.GetValue1() + ") is NOT equal to " + obj.GetValue2() + " and it should be."));
        }
Beispiel #4
0
        public void IfNotEqualWithMessage(Pair obj)
        {
            // ACT
            var exception = Assert.Throws <DesignByContractViolationException>(
                () => Fail.IfNotEqual(obj.Value1, obj.Value2, Violation.Of("values differ and should be equal"))
                );

            // ASSERT
            Assert.That(exception.Message, Is.EqualTo("values differ and should be equal"));
        }
Beispiel #5
0
 public void IfNotEqualSuccess()
 {
     // ACT
     Fail.IfNotEqual("s1", "s1", "values differ and should be equal");
 }
Beispiel #6
0
 public void IfNotEqualWithNameSuccess(Pair obj)
 {
     // ACT
     Fail.IfNotEqual(obj.Value1, obj.Value2, nameof(obj));
 }
Beispiel #7
0
 public void IfNotEqualWithMessageSuccess(Pair obj)
 {
     // ACT
     Fail.IfNotEqual(obj.Value1, obj.Value2, Violation.Of("values differ and should be equal"));
 }