Esempio n. 1
0
        public void IfNotEqualNulls()
        {
            // ARRANGE
            object o1 = null;
            object o2 = null;

            // ACT
            Fail.IfNotEqual(o1, o2, "values differ and should be equal");
        }
Esempio n. 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"));
        }
Esempio n. 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."));
        }
Esempio n. 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"));
        }
Esempio n. 5
0
 public void IfNotEqualSuccess()
 {
     // ACT
     Fail.IfNotEqual("s1", "s1", "values differ and should be equal");
 }
Esempio n. 6
0
 public void IfNotEqualWithNameSuccess(Pair obj)
 {
     // ACT
     Fail.IfNotEqual(obj.Value1, obj.Value2, nameof(obj));
 }
Esempio n. 7
0
 public void IfNotEqualWithMessageSuccess(Pair obj)
 {
     // ACT
     Fail.IfNotEqual(obj.Value1, obj.Value2, Violation.Of("values differ and should be equal"));
 }