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